2 回答
TA贡献1890条经验 获得超9个赞
如果您的数据透视表同时具有RowGrandAND ColumnGrand,那么它也有一个总计
if (pivot.RowGrand && pivot.ColumnGrand)
然后您可以使用数据透视表的最后一个单元格TableRange1生成详细信息ShowDetail
int countRows = pivot.TableRange1.Rows.Count;
int countColumns = pivot.TableRange1.Columns.Count;
pivot.TableRange1.Cells[countRows, countColumns].ShowDetail = true;
TA贡献1155条经验 获得超0个赞
也许这可以帮助
// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Access the pivot field by its name in the collection.
PivotField field = pivotTable.Fields["Category"];
// Display multiple subtotals for the field.
field.SetSubtotal(PivotSubtotalFunctions.Sum | PivotSubtotalFunctions.Average);
// Show all subtotals at the bottom of each group.
pivotTable.Layout.ShowAllSubtotals(false);
// Hide grand totals for rows.
pivotTable.Layout.ShowRowGrandTotals = False
// Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = False
// custom label for grand totals
pivotTable.View.GrandTotalCaption = "Total Sales";
- 2 回答
- 0 关注
- 93 浏览
添加回答
举报