From d22d40cdc2c1f5020a13d87899632458c9ae1b51 Mon Sep 17 00:00:00 2001 From: dfinke Date: Wed, 3 Oct 2018 19:26:37 -0400 Subject: [PATCH 1/3] Renamed PivotTableSyle to PivotTableStyle - fixes #453 --- Examples/PivotTable/TableAndPivotTable.ps1 | 2 +- PivotTable.ps1 | 10 +++++----- __tests__/ExtraLongCmd.tests.ps1 | 2 +- __tests__/Set-Row_Set-Column-SetFormat.tests.ps1 | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Examples/PivotTable/TableAndPivotTable.ps1 b/Examples/PivotTable/TableAndPivotTable.ps1 index 32b0b29f..310fc8c5 100644 --- a/Examples/PivotTable/TableAndPivotTable.ps1 +++ b/Examples/PivotTable/TableAndPivotTable.ps1 @@ -15,7 +15,7 @@ Apple, New York, 1200,700 #Add a pivot table, specify its address to put it on the same sheet, use the data that was just exported set the table style and number format. #Use the "City" for the row names, and "Product" for the columnnames, and sum both the gross and net values for each City/Product combination; add grand totals to rows and columns. # activate the sheet and add a pivot chart (defined in a hash table) -Add-PivotTable -Address $excel.Sheet1.Cells["F1"] -SourceWorkSheet $Excel.Sheet1 -SourceRange $Excel.Sheet1.Dimension.Address -PivotTableName "Sales" -PivotTableSyle "Medium12" -PivotNumberFormat "$#,##0.00" ` +Add-PivotTable -Address $excel.Sheet1.Cells["F1"] -SourceWorkSheet $Excel.Sheet1 -SourceRange $Excel.Sheet1.Dimension.Address -PivotTableName "Sales" -PivotTableStyle "Medium12" -PivotNumberFormat "$#,##0.00" ` -PivotRows "City" -PivotColumns "Product" -PivotData @{Gross="Sum";Net="Sum"}-PivotTotals "Both" -Activate -PivotChartDefinition @{ Title="Gross and net by city and product"; ChartType="ColumnClustered"; diff --git a/PivotTable.ps1 b/PivotTable.ps1 index b90e3179..48bc2579 100644 --- a/PivotTable.ps1 +++ b/PivotTable.ps1 @@ -29,7 +29,7 @@ Add-PivotTable -PivotTableName Sales -Address $excel.Workbook.Worksheets[1].Cells["F1"] ` -SourceWorkSheet $excel.Workbook.Worksheets[1] -PivotRows City -PivotColumns Product -PivotData @{Gross="Sum";Net="Sum"} ` - -PivotNumberFormat "$#,##0.00" -PivotTotals Both -PivotTableSyle Medium12 -PivotChartDefinition $chartdef + -PivotNumberFormat "$#,##0.00" -PivotTotals Both -PivotTableStyle Medium12 -PivotChartDefinition $chartdef Close-ExcelPackage -show $excel @@ -74,7 +74,7 @@ #Number format to apply to the data cells in the PivotTable. [string]$PivotNumberFormat, #Apply a table style to the PivotTable. - [OfficeOpenXml.Table.TableStyles]$PivotTableSyle, + [OfficeOpenXml.Table.TableStyles]$PivotTableStyle, #Use a chart definition instead of specifying chart settings one by one. [Parameter(ParameterSetName='ChartbyDef', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] $PivotChartDefinition, @@ -198,7 +198,7 @@ if ($PivotTotals -eq "None" -or $PivotTotals -eq "Rows") { $pivotTable.ColumGrandTotals = $false } # Epplus spelling mistake, not mine! elseif ($PivotTotals -eq "Both" -or $PivotTotals -eq "Columns") { $pivotTable.ColumGrandTotals = $true } if ($PivotDataToColumn ) { $pivotTable.DataOnRows = $false } - if ($PivotTableSyle) { $pivotTable.TableStyle = $PivotTableSyle} + if ($PivotTableStyle) { $pivotTable.TableStyle = $PivotTableStyle} } catch {Write-Warning -Message "Failed adding PivotTable '$pivotTableName': $_"} } @@ -230,7 +230,7 @@ function New-PivotTableDefinition { <# .Synopsis - Creates PivotTable definitons for Export-Excel + Creates PivotTable definitons for Export-Excel .Description Export-Excel allows a single PivotTable to be defined using the parameters -IncludePivotTable, -PivotColumns -PivotRows, -PivotData, -PivotFilter, -PivotTotals, -PivotDataToColumn, -IncludePivotChart and -ChartType. @@ -274,7 +274,7 @@ function New-PivotTableDefinition { #Number format to apply to the data cells in the PivotTable [string]$PivotNumberFormat, #Apply a table style to the PivotTable - [OfficeOpenXml.Table.TableStyles]$PivotTableSyle, + [OfficeOpenXml.Table.TableStyles]$PivotTableStyle, #Use a chart definition instead of specifying chart settings one by one [Parameter(ParameterSetName='ChartbyDef', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] $PivotChartDefinition, diff --git a/__tests__/ExtraLongCmd.tests.ps1 b/__tests__/ExtraLongCmd.tests.ps1 index d1fcda78..13d1964d 100644 --- a/__tests__/ExtraLongCmd.tests.ps1 +++ b/__tests__/ExtraLongCmd.tests.ps1 @@ -11,7 +11,7 @@ Orange, Paris, 600, 500 Banana, Paris, 300, 200 Apple, New York, 1200,700 "@ | Export-Excel -Path $path -TableStyle Medium13 -tablename "RawData" -ConditionalFormat @{Range="C2:C7"; DataBarColor="Green"} -ExcelChartDefinition @{ChartType="Doughnut";XRange="A2:B7"; YRange="C2:C7"; width=800; } -PivotTableDefinition @{Sales=@{ - PivotRows="City"; PivotColumns="Product"; PivotData=@{Gross="Sum";Net="Sum"}; PivotNumberFormat="$#,##0.00"; PivotTotals="Both"; PivotTableSyle="Medium12"; Activate=$true + PivotRows="City"; PivotColumns="Product"; PivotData=@{Gross="Sum";Net="Sum"}; PivotNumberFormat="$#,##0.00"; PivotTotals="Both"; PivotTableStyle="Medium12"; Activate=$true PivotChartDefinition=@{Title="Gross and net by city and product"; ChartType="ColumnClustered"; Column=6; Width=600; Height=360; YMajorUnit=500; YMinorUnit=100; YAxisNumberformat="$#,##0"; LegendPosition="Bottom"}}} $excel = Open-ExcelPackage $path diff --git a/__tests__/Set-Row_Set-Column-SetFormat.tests.ps1 b/__tests__/Set-Row_Set-Column-SetFormat.tests.ps1 index 5ba8d472..7b6bff3c 100644 --- a/__tests__/Set-Row_Set-Column-SetFormat.tests.ps1 +++ b/__tests__/Set-Row_Set-Column-SetFormat.tests.ps1 @@ -326,7 +326,7 @@ Describe "Table Formatting" { #test expnading named number formats Set-ExcelColumn -Worksheet $ws -Column 4 -NumberFormat 'Currency' Set-ExcelColumn -Worksheet $ws -Column 5 -NumberFormat 'Currency' - $PtDef =New-PivotTableDefinition -PivotTableName Totals -PivotRows Product -PivotData @{"Total"="Sum"} -PivotNumberFormat Currency -PivotTotals None -PivotTableSyle Dark2 + $PtDef =New-PivotTableDefinition -PivotTableName Totals -PivotRows Product -PivotData @{"Total"="Sum"} -PivotNumberFormat Currency -PivotTotals None -PivotTableStyle Dark2 Export-excel -ExcelPackage $excel -WorksheetName Hardware -PivotTableDefinition $PtDef $excel= Open-ExcelPackage -Path $path $ws1 = $excel.Workbook.Worksheets["Hardware"] From bf2e37ac9f27d77a395b164034c2786e7867c0f9 Mon Sep 17 00:00:00 2001 From: dfinke Date: Thu, 4 Oct 2018 09:57:04 -0400 Subject: [PATCH 2/3] bumped version to 5.3.4 --- ImportExcel.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ImportExcel.psd1 b/ImportExcel.psd1 index d868a1ef..ad4d66ec 100644 --- a/ImportExcel.psd1 +++ b/ImportExcel.psd1 @@ -4,7 +4,7 @@ RootModule = 'ImportExcel.psm1' # Version number of this module. - ModuleVersion = '5.3.3' + ModuleVersion = '5.3.4' # ID used to uniquely identify this module GUID = '60dd4136-feff-401a-ba27-a84458c57ede' From 5158addc36ba933e94e301cac2c5b8bf8abffe23 Mon Sep 17 00:00:00 2001 From: dfinke Date: Thu, 4 Oct 2018 09:57:22 -0400 Subject: [PATCH 3/3] Hotfix for misnamed parameter --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e35de01f..31d2dc30 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,11 @@ Install-Module ImportExcel -scope CurrentUser Install-Module ImportExcel ``` - # What's new 5.3.3 +# What's new 5.3.4 + +- HotFix for parameter PivotTableSyle should be PivotTableStyle https://github.com/dfinke/ImportExcel/issues/453 + +# What's new 5.3.3 - Thank you to (lazywinadmin)[https://github.com/lazywinadmin] - Expand aliases in examples and elsewhere - In Export-Excel fixed a bug where -AutoNameRange on pre-existing data included the header in the range.