Hi,
I have used Aspose.cells to create an excel spresheet with subtotal and grantotal base on the same column index (i.e. grand total will be level 1 Symbol Outline and subtotal will be level 2 Symbol Outline). However, if I do
worksheet.Cells.HideGroupDetail(true, col_index);
all row will be colapse base on grandtotal, i.e. I can only see grandtotal on the sheet as the result. But What I really want is to mimic the action of clicking the OutlineSymbol 2, i.e. row collapse base on subtotal.
Can you please kindly advise how I can achieve that?
Thanks.
Edbert
Hi,
Could you provide us your template file that you may manually create in MS Excel to show your desired needs regarding group rows/details. Also provide us the output file that is generated by Aspose.Cells APIs and paste the sample code (runnable) with the template file (input file) if you have any, this will help us to evaluate your issue properly.
Thank you.
Please see the attachment. I have put a tab of "what I want to display". and a tab of "what is currently displaying". You can convert from the what is currently displayingwhat is currently displayingtab format into what I want to display" tab, by clisking Symbol Outline 2. I need to know how I can achieve that programatically.
Thanks.
Hi,
I think you may try the following sample code for your needs:
e.g
Sample code:
Workbook book = new Workbook(“e:\test2\example.xlsx”);
Worksheet sheet = book.Worksheets[1];
for (int i = 0; i <= sheet.Cells.MaxRow; i++)
{
int rowOutlineLevel = sheet.Cells.GetGroupedRowOutlineLevel(i);
if (rowOutlineLevel == 2)//zero-based
{
sheet.Cells.HideRow(i);
}
// sheet.Cells.HideGroupDetail(true, i);
//To Show or expand the grouped rows if you want.
// sheet.Cells.ShowGroupDetail(true, i);
}
book.Save(“e:\test2\out1.xlsx”);
Hope, this helps you a bit.
Thank you.