Creating Subtotals - subtotal parameter doesn't work

John Huang:


Hi there
I'm using the trial version now.Now I have two questions.
1.The subtotal parameter doesn't work.
2.After I set the Picture parameter into the excel file, when the workdesigner.process method was executed, a out of range exception was threw.

Hi there, I coded as the snippets above. And there is the same table. But I couldn't get the same result.I use the trial version now.
Thanks

Post Link: ( http://www.aspose.com/docs/display/cellsnet/Creating%20Subtotals )

Hi,

Thanks for using Aspose.Cells for .NET.

I have successfully exectued the Creating Subtotals code snippet with the source xlsx file attached to this post using the latest version:
Aspose.Cells
for .NET v7.2.2.5


I have attached the output xlsx file and the screenshot for your reference. Please see the test code below.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\Subtotal.xlsx”;


//Instantiate a new workbook

//Open the template file

Workbook workbook = new Workbook(filePath);


//Get the Cells collection in the first worksheet

Cells cells = workbook.Worksheets[0].Cells;


//Create a cellarea i.e…, B3:C19

CellArea ca = new CellArea();

ca.StartRow = 2;

ca.StartColumn = 1;

ca.EndRow = 18;

ca.EndColumn = 2;


//Apply subtotal, the consolidation function is Sum and it will applied to

//Second column (C) in the list

cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 1 });


//Save the excel file

workbook.Save(filePath + “.out.xlsx”);



Screenshot: