From 06124e12e79ef3d7ed0ba5d450db081b1d6f9ee8 Mon Sep 17 00:00:00 2001 From: ili101 Date: Thu, 5 Oct 2017 00:02:06 +0300 Subject: [PATCH 1/2] Fix Bug. AutoFilter with TableName corrupted file Fix Bug, AutoFilter with TableName create corrupted Excel file. https://github.com/dfinke/ImportExcel/issues/65 You now cannot set AutoFilter and TableName at the same time. "-Now" will not auto add AutoFilter if TableName set. --- Export-Excel.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 98d9be9..96e4faf 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -194,7 +194,7 @@ Function Export-Excel { https://github.com/dfinke/ImportExcel #> - [CmdLetBinding()] + [CmdletBinding(DefaultParameterSetName='Default')] Param( $Path, [Parameter(ValueFromPipeline=$true)] @@ -223,6 +223,7 @@ Function Export-Excel { [Switch]$FreezeFirstColumn, [Switch]$FreezeTopRowFirstColumn, [Int[]]$FreezePane, + [Parameter(ParameterSetName='Default')] [Switch]$AutoFilter, [Switch]$BoldTopRow, [Switch]$NoHeader, @@ -240,8 +241,10 @@ Function Export-Excel { else { $true } - })] + })] + [Parameter(ParameterSetName='Table')] [String]$TableName, + [Parameter(ParameterSetName='Table')] [OfficeOpenXml.Table.TableStyles]$TableStyle = 'Medium6', [Object[]]$ExcelChartDefinition, [String[]]$HideSheet, @@ -386,7 +389,10 @@ Function Export-Excel { $Path = [System.IO.Path]::GetTempFileName() -replace '\.tmp','.xlsx' $Show = $true $AutoSize = $true - $AutoFilter = $true + if (!$TableName) + { + $AutoFilter = $true + } } $Path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path) From 8ad38b544ee9100a51bb3e861c735d73aa49f6bd Mon Sep 17 00:00:00 2001 From: ili101 Date: Thu, 5 Oct 2017 00:15:57 +0300 Subject: [PATCH 2/2] Fix Bug, Unable to find type [PSPlot] in ISE When loading cmdlet info from ISE "Commands" panel you get the error "Unable to find type [PSPlot]" https://github.com/dfinke/ImportExcel/issues/131 --- ImportExcel.psm1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/ImportExcel.psm1 b/ImportExcel.psm1 index decf817..67552ed 100644 --- a/ImportExcel.psm1 +++ b/ImportExcel.psm1 @@ -30,8 +30,6 @@ if ($PSVersionTable.PSVersion.Major -ge 5) { . $PSScriptRoot\Plot.ps1 Function New-Plot { - [OutputType([PSPlot])] - Param() [PSPlot]::new() }