From ff25cb45dad2cdb05588137a842d70f53de3336f Mon Sep 17 00:00:00 2001 From: dfinke Date: Mon, 25 Jan 2016 09:37:31 -0500 Subject: [PATCH] Made parameter names the same --- Examples/ConditionalFormatting/GetProcess.ps1 | 2 +- Export-Excel.ps1 | 18 +++++++++--------- New-ConditionalFormattingIconSet.ps1 | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Examples/ConditionalFormatting/GetProcess.ps1 b/Examples/ConditionalFormatting/GetProcess.ps1 index d782b3c..2a1bcad 100644 --- a/Examples/ConditionalFormatting/GetProcess.ps1 +++ b/Examples/ConditionalFormatting/GetProcess.ps1 @@ -4,7 +4,7 @@ ps | where Company | select Company, Name, PM, Handles, *mem* | Export-Excel .\testExport.xlsx -Show -AutoSize -AutoNameRange ` -ConditionalFormat $( - New-ConditionalFormattingIconSet -Address "C:C" ` + New-ConditionalFormattingIconSet -Range "C:C" ` -ConditionalFormat ThreeIconSet -IconType Arrows ) -ConditionalText $( diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 717acaa..06992a8 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -45,7 +45,7 @@ function Export-Excel { [string]$TableName, [OfficeOpenXml.Table.TableStyles]$TableStyle="Medium6", [Object[]]$ConditionalFormat, - [Object[]]$ConditionalText, + [Object[]]$ConditionalText, [Object[]]$ExcelChartDefinition, [string[]]$HideSheet, [Switch]$KillExcel, @@ -71,7 +71,7 @@ function Export-Excel { foreach($format in $ConditionalFormat ) { $target = "Add$($format.Formatter)" - $rule = ($ws.ConditionalFormatting).$target($format.Address, $format.IconType) + $rule = ($ws.ConditionalFormatting).$target($format.Range, $format.IconType) $rule.Reverse = $format.Reverse } @@ -337,25 +337,25 @@ function Export-Excel { } } - if($ConditionalText) { + if($ConditionalText) { foreach ($targetConditionalText in $ConditionalText) { - $target = "Add$($targetConditionalText.ConditionalType)" - + $target = "Add$($targetConditionalText.ConditionalType)" + $Range=$targetConditionalText.Range if(!$Range) { $Range=$ws.Dimension.Address } $rule=($ws.Cells[$Range].ConditionalFormatting).$target() - + if($targetConditionalText.Text) { $rule.Text = $targetConditionalText.Text - } - + } + $rule.Style.Font.Color.Color = $targetConditionalText.ConditionalTextColor $rule.Style.Fill.PatternType=$targetConditionalText.PatternType $rule.Style.Fill.BackgroundColor.Color=$targetConditionalText.BackgroundColor } } - + $pkg.Save() $pkg.Dispose() diff --git a/New-ConditionalFormattingIconSet.ps1 b/New-ConditionalFormattingIconSet.ps1 index d30b8d9..c355150 100644 --- a/New-ConditionalFormattingIconSet.ps1 +++ b/New-ConditionalFormattingIconSet.ps1 @@ -1,7 +1,7 @@ function New-ConditionalFormattingIconSet { param( [Parameter(Mandatory=$true)] - $Address, + $Range, [ValidateSet("ThreeIconSet","FourIconSet","FiveIconSet")] $ConditionalFormat, [Switch]$Reverse @@ -42,7 +42,7 @@ function New-ConditionalFormattingIconSet { $bp = @{}+$PSBoundParameters $obj = [PSCustomObject]@{ - Address = $Address + Range = $Range Formatter = $ConditionalFormat IconType = $bp.IconType Reverse = $Reverse