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.