From 5e4220bd09277d2f33c9d1e2e9342b6e03a0f8bb Mon Sep 17 00:00:00 2001 From: dfinke Date: Tue, 2 Jan 2018 16:08:00 -0500 Subject: [PATCH] Supports excluding Row Grand Totals --- Export-Excel.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index e2b0bbe..f35ca21 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -398,7 +398,8 @@ [Parameter(ParameterSetName = 'Now')] # [Parameter(ParameterSetName = 'TableNow')] [Switch]$Now, - [Switch]$ReturnRange + [Switch]$ReturnRange, + [Switch]$NoTotalsInPivot ) Begin { @@ -784,6 +785,10 @@ if ($item.value.ChartTitle) {$chart.Title.Text = $item.value.chartTitle} } } + + if($item.Value.NoTotalsInPivot) { + $pivotTable.RowGrandTotals = $false + } } } @@ -829,6 +834,10 @@ $pivotTable.DataOnRows = $false } } + + if($NoTotalsInPivot) { + $pivotTable.RowGrandTotals = $false + } if ($IncludePivotChart) { $chart = $wsPivot.Drawings.AddChart('PivotChart', $ChartType, $pivotTable) @@ -1007,7 +1016,8 @@ function New-PivotTableDefinition { [Switch]$NoLegend, [Switch]$ShowCategory, [Switch]$ShowPercent, - [String]$ChartTitle + [String]$ChartTitle, + [Switch]$NoTotalsInPivot ) $parameters = @{} + $PSBoundParameters