计算小计
Contents
[
Hide
]
Aspose.Cells - 计算小计
您可以为电子表格中的任何重复值自动创建小计。 Aspose.Cells 提供 API 功能,可帮助您以编程方式将小计添加到电子表格。
C#
//Instantiating a Workbook object
Workbook workbook = new Workbook("../../data/test.xlsx");
//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("AsposeTotal.xls");
下载运行代码
下载计算小计形成以下任何一个社交编码网站:
欲了解更多详情,请访问创建小计.