diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index d8a878f..6fabc11 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -40,7 +40,8 @@ function Export-Excel { [Switch]$AutoFilter, [Switch]$BoldTopRow, [string]$RangeName, - [string]$TableName + [string]$TableName, + [Object[]]$ConditionalFormat ) Begin { @@ -53,6 +54,18 @@ function Export-Excel { $ws = $pkg | Add-WorkSheet -WorkSheetname $WorkSheetname -NoClobber:$NoClobber + foreach($format in $ConditionalFormat ) { + #$obj = [PSCustomObject]@{ + # Address = $Address + # Formatter = $ConditionalFormat + # IconType = $bp.IconType + #} + + $target = "Add$($format.Formatter)" + $rule = ($ws.ConditionalFormatting).$target($format.Address, $format.IconType) + $rule.Reverse = $format.Reverse + } + $Row = 1 if($Title) { $ws.Cells[$Row, 1].Value = $Title diff --git a/New-ConditionalFormattingIconSet.ps1 b/New-ConditionalFormattingIconSet.ps1 index 80af420..b016eec 100644 --- a/New-ConditionalFormattingIconSet.ps1 +++ b/New-ConditionalFormattingIconSet.ps1 @@ -3,7 +3,8 @@ function New-ConditionalFormattingIconSet { [Parameter(Mandatory=$true)] $Address, [ValidateSet("ThreeIconSet","FourIconSet","FiveIconSet")] - $ConditionalFormat + $ConditionalFormat, + [bool]$Reverse ) DynamicParam { @@ -44,6 +45,7 @@ function New-ConditionalFormattingIconSet { Address = $Address Formatter = $ConditionalFormat IconType = $bp.IconType + Reverse = $Reverse } $obj.pstypenames.Clear() @@ -51,4 +53,4 @@ function New-ConditionalFormattingIconSet { $obj } -} +} \ No newline at end of file