Free Support Forum - aspose.com

Smart marker and collection

Hi,

Does Smart Marker support export single object in a collection? For example, I have a collection with five objects, and I want to export the second object, is it possible?

Hi,


I am not sure about your scenario / issue. Please create a sample JAVA program (runnable) and paste it here, also attach your template Excel file (if you have any with Smart Markers) and output file here to look into your issue. We will check your issue soon.

Thank you.

Hi,

For exmaple, I have a Java object named Teacher and a teacher can has many students.
In some templates, our customers wants to print the first five students and in others our customers wants to print all the students. I’m wondering if Smart Marker can print the first five students in an Arraylist using index?

Hi,


Well, I am afraid, there is no such option available in the product for Smart Markers. When you input a marker in a cell in the template file’s worksheet, the records would be filled based on your object (e.g custom object, array list, variables array, datatable etc.) behind, so all the rows would be retrieved by default unless you remove your unwanted records in your object manually before specifying the data source for the markers by using your own code.

By the way, if you are retreiving data from a table (in a data source / database etc.), you could retrieve your n number of records by using SQL query’s TOP clause. e.g
SELECT TOP N select list
FROM TableName
you may also add order by and where clause to filter your query further accordingly.

Thank you.


Hi,

Thanks for your posting and using Aspose.Cells for Java.

We are afraid, this feature is not supported. We will evaluate your requirements and implement it if possible.

We have logged this issue in our database. Once, this issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40417.

Hi,

starrabbit:
Hi,
For exmaple, I have a Java object named Teacher and a teacher can has many students.
In some templates, our customers wants to print the first five students and in others our customers wants to print all the students. I'm wondering if Smart Marker can print the first five students in an Arraylist using index?

Well, after looking into your requirement, we come to know and as I told you that our Smart Markers are pretty much straight forward, so it will totally depend on your source data (either in the array/list of table (database)) or as per your query(select statement) etc. Aspose.Cells cannot support your needs for Smart Markers, you have to control it by yourself. First of all check my SQL example for TOP N query, you may use it but you have to manage/fill your data source in some database/table accordingly. For example, you may have a worksheet that would behave for N (parameter) and you will hide that worksheet in the template file for each client accordingly for your number of records which you need to retrieve from the data source, then you can create collection with your desired parameter for your clients accordingly.

See the attached template file that has a first worksheet which would work to provide you the parameter for N number of records. The Sheet1 in the file should be hidden so no user could see it.

Sample code (this is generic code):
e.g

Workbook workbook = new Workbook(@"e:\test2\Book1.xlsx");
WorkbookDesigner designer = new WorkbookDesigner();
designer.Workbook = workbook;
int N = workbook.Worksheets[0].Cells["B1"].IntValue;
//......... Your query will be managed by you.
//SELECT TOP N select list
//FROM TableName
//................
designer.SetDataSource(...);
designer.Process();
workbook.Save(@"e:\test2\dest.xlsx");

So, you should select the data with your desired N records in hidden worksheet and get it in your markers' sheet (second sheet) accordingly.

Hope, you understand it now.

Thank you.