-
Notifications
You must be signed in to change notification settings - Fork 5
Calculate Sub Totals
shoaibkhan-aspose edited this page Apr 17, 2014
·
1 revision
//Instantiate a new workbook
Workbook workbook = new Workbook("book1.xls");
//Get the Cells collection in the first worksheet
Cells cells = workbook.getWorksheets().get(0).getCells();
//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("AsposeTotal.xls");
Download Source Code
For further releases and updates, please follow these new repositories:
- Aspose.Words Java for Apache POI
- Aspose.Cells Java for Apache POI
- Aspose.Slides Java for Apache POI
- Aspose.Email Java for Apache POI
- For documentation, please visit Aspose Docs.
- Raise your queries and suggest more examples via Aspose Forums or via new social coding sites.