Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

CLOSEDXML PIVOT: Subtotal per Row

$
0
0

I am creating a pivot table using ClosedXML in VB.Net.

Dim ptj = xlWorksheet2.PivotTables.Add("Company", xlWorksheet.Cell(1, 1), xlWorksheet.Range("A1:J"& xlintStartRow - 1))ptj.RowLabels.Add("Region")ptj.RowHeaderCaption = "Region"ptj.Subtotals = XLPivotSubtotals.AtBottomptj.ClassicPivotTableLayout = Trueptj.Layout = XLPivotLayout.Tabularptj.RowLabels.Add("District")ptj.RowHeaderCaption = "District"ptj.Subtotals = XLPivotSubtotals.DoNotShowptj.ClassicPivotTableLayout = Trueptj.Layout = XLPivotLayout.Tabularptj.RowLabels.Add("Territory")ptj.RowHeaderCaption = "Territory"ptj.Subtotals = XLPivotSubtotals.DoNotShowptj.ClassicPivotTableLayout = Trueptj.Layout = XLPivotLayout.Tabularptj.ColumnLabels.Add("YEAR") ptj.ColumnHeaderCaption = "YEAR"ptj.Values.Add("AMT", "SALES").NumberFormat.Format = "#,##0.00"

I want to customize subtotals of each row but my code doesn't work. This is my desired output:

enter image description here

EDIT:THIS IS MY ACTUAL OUTPUT

I think it only accepts one Subtotals then applied to all rows.

There is also SetSubtotals function for closedxml pivot table, and tried using the code, but there are no output changes

enter image description here


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>