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 關注
- 114 瀏覽
添加回答
舉報