Grouping rows problem

Hi, I am trying to produce grouping rows similar to the attached grpexample.xlsx. note that there is a group header node that is like a summary node, but not calculated..I noticed the template I produced(grptemplate.xls) always have one row more...if I group row 7-row 16, the end will include row 17. Please help.

thanks,

Lin

my sample code would look like:

public static void main(String[] args)
{
Workbook wk = new Workbook();
Worksheet ws = wk.getWorksheets().getSheet(0);
for (int i = 0; i < 103; i++)
{
for (int j = 0; j < 2; j++)
{
ws.getCells().getCell(i, j).setValue("Dummy content");
}
}
ws.getOutline().setSummaryRowBelow(false);
ws.getCells().groupRows(7,16, false);
ws.getCells().groupRows(8, 16, false);
ws.getCells().groupRows(18,19, false);
ws.getCells().groupRows(19, 19, false);
ws.getCells().groupRows(21,22, false);
ws.getCells().groupRows(22, 22, false);
ws.getCells().groupRows(24,27, false);
ws.getCells().groupRows(25,27, false);
ws.getCells().groupRows(29,34, false);
ws.getCells().groupRows(30,34, false);
ws.getCells().groupRows(36,38, false);
ws.getCells().groupRows(37,38, false);
ws.getCells().groupRows(40,41, false);
ws.getCells().groupRows(41,41, false);
ws.getCells().groupRows(43,45, false);
ws.getCells().groupRows(44,45, false);
ws.getCells().groupRows(47,48, false);
ws.getCells().groupRows(48,48, false);
ws.getCells().groupRows(50,98, false);
ws.getCells().groupRows(51,98, false);
ws.getCells().groupRows(100,102, false);
ws.getCells().groupRows(101,102, false);

try{
wk.save("c:\\samples\\grptemplate.xls");
}catch(IOException e)
{
;
}

}

Hi,

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

The row index is 0-based index. So, the first row index will be 0, the second row index will be 1 and third row index will be 2 and so on…

That’s why, when you use row index 16, it includes 17th row.

thank you. I have another problem..why sometimes even I specified setSummaryRowBelow(false), the excel template produced has summary row below...?

thanks,

Lin

Hi,

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

Please download and use the latest version: Aspose.Cells
for Java v7.5.3.2
. It works fine.

Please see the upgraded code below. We have also attached the output file for your reference.

Java


Workbook wk = new Workbook();

Worksheet ws = wk.getWorksheets().get(0);

for (int i = 0; i < 103; i++)

{

for (int j = 0; j < 2; j++)

{

ws.getCells().get(i, j).putValue(“Dummy content”);

}

}

ws.getOutline().SummaryRowBelow = false;

ws.getCells().groupRows(7,16, false);

ws.getCells().groupRows(8, 16, false);

ws.getCells().groupRows(18,19, false);

ws.getCells().groupRows(19, 19, false);

ws.getCells().groupRows(21,22, false);

ws.getCells().groupRows(22, 22, false);

ws.getCells().groupRows(24,27, false);

ws.getCells().groupRows(25,27, false);

ws.getCells().groupRows(29,34, false);

ws.getCells().groupRows(30,34, false);

ws.getCells().groupRows(36,38, false);

ws.getCells().groupRows(37,38, false);

ws.getCells().groupRows(40,41, false);

ws.getCells().groupRows(41,41, false);

ws.getCells().groupRows(43,45, false);

ws.getCells().groupRows(44,45, false);

ws.getCells().groupRows(47,48, false);

ws.getCells().groupRows(48,48, false);

ws.getCells().groupRows(50,98, false);

ws.getCells().groupRows(51,98, false);

ws.getCells().groupRows(100,102, false);

ws.getCells().groupRows(101,102, false);


wk.save(“F:\Shak-Data-RW\Downloads\output.xlsx”);



the summaryRow is confusing to me. I have a template that has group nodes, I need to expand and collapse as attached.. if there is only one leaf node, and we need to show the outline at the top. how do set it correctly?

thanks,

L.

Thanks, It works fine in my simple test java program as well, however, the summary line goes to bottom in my application. I am trying to find out what causes the summary line changes. the codes in application are very similar to the test program. Can you give me some idea why might cause the problem happen?

thanks,

L.

Hi, I just found out the situations that will put summary line to the bottom even I set the SummaryRowBelow to false. It is when I save the file to xlsx output. will try to upgrade to latest version, and test.

thanks,

Lin

Hi,

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

Please download and try the latest version: Aspose.Cells
for Java v7.5.3.2
. It works fine as we have tested it. The older version is not working fine because of some bug. Please upgrade to latest version to resolve this issue.