UsingGenericList

Following the example in the “UsingGenericList” in the aspose-cells sample code, we have:

worksheet.getCells().get(“A1”).putValue(“Husband Name”);
worksheet.getCells().get(“A2”).putValue("&=Husband.Name");

worksheet.getCells().get(“B1”).putValue(“Husband Age”);
worksheet.getCells().get(“B2”).putValue("&=Husband.Age");

worksheet.getCells().get(“C1”).putValue(“Wife’s Name”);
worksheet.getCells().get(“C2”).putValue("&=Husband.Wives.Name");

worksheet.getCells().get(“D1”).putValue(“Wife’s Age”);
worksheet.getCells().get(“D2”).putValue("&=Husband.Wives.Age");

The output will be:

Husband Name Husband Age Wife’s Name Wife’s Age
Mark John 30 Chen Zhao 34
Jamima Winfrey 28
Reham Smith 35
Masood Shankar 40 Karishma Jathool 36
Angela Rose 33
Hina Khanna 45

The output we are trying to achieve is:

If we want to have the Husband name on top and the list of wives under the husband name as below:

Mark John
Chen Zhao 34
Jamima Winfrey 28
Reham Smith 35

Masood Shankar
Karishma Jathool 36
Angela Rose 33
Hina Khanna 45

We have tried the following modifications:

worksheet.getCells().get(“A1”).putValue("&=Husband.Name");

worksheet.getCells().get(“A2”).putValue("&=Husband.Wives.Name");

worksheet.getCells().get(“B2”).putValue("&=Husband.Wives.Age");

But the output does not reflect that:

Mark John
Masood Shankar
Chen Zhao 34
Jamima Winfrey 28
Reham Smith 35
Karishma Jathool 36
Angela Rose 33
Hina Khanna 45

If “&=Husband.name” and “&=Husband.Wives.Name” are not in the same row, they don’t display under each other, the names of all the husbands will be displayed first, then all the wives list will be shown below that husband names list.

@gerry.wen

Thanks for considering Aspose.Cells.

We were able to understand your requirements but partially. Please provide us your Excel file with multiple sheets. One sheet should contain your data (data source). Other sheet should contain the smart markers and the other sheet should contain your actual output. The last (final) sheet should contain your desired output which you want to achieve. You can create all these sheets manually using Microsoft Excel.

These things will help us look into your issue more closely and precisely and we will help you asap.

cell_ticket.zip (8.9 KB)

Thank you for your quick response!

Regards,

Gerry

@gerry.wen

We have checked your smart marker template Excel file and found, these are just nested objects. Aspose.Cells for Java (as well as .NET) supports Nested Objects up to 1 level. If you have 2nd or 3rd (or more) level Nested Objects, they are not supported.

Please see the “Using Nested Objects” section in the given article for your needs.