2 回答

TA貢獻(xiàn)1890條經(jīng)驗(yàn) 獲得超9個(gè)贊
如果您的數(shù)據(jù)透視表同時(shí)具有RowGrandAND ColumnGrand,那么它也有一個(gè)總計(jì)
if (pivot.RowGrand && pivot.ColumnGrand)
然后您可以使用數(shù)據(jù)透視表的最后一個(gè)單元格TableRange1生成詳細(xì)信息ShowDetail
int countRows = pivot.TableRange1.Rows.Count;
int countColumns = pivot.TableRange1.Columns.Count;
pivot.TableRange1.Cells[countRows, countColumns].ShowDetail = true;

TA貢獻(xiàn)1155條經(jīng)驗(yàn) 獲得超0個(gè)贊
也許這可以幫助
// 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 關(guān)注
- 125 瀏覽
添加回答
舉報(bào)