mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Merge pull request #454 from dfinke/FixPivotStyleName
Renamed PivotTableSyle to PivotTableStyle - fixes #453
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user