From 27dea78413c29d1bb3a32fececb5991dcbc408d8 Mon Sep 17 00:00:00 2001 From: headsphere Date: Wed, 21 Sep 2016 13:22:57 +0100 Subject: [PATCH 1/2] Update Export-Excel.ps1 Fixed problem with conditional formatting code that was breaking in Powershell 3 --- Export-Excel.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 1dd1ec04..72e0d66d 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -78,7 +78,7 @@ function Export-Excel { foreach($format in $ConditionalFormat ) { $target = "Add$($format.Formatter)" - $rule = ($ws.ConditionalFormatting).$target($format.Range, $format.IconType) + $rule = ($ws.ConditionalFormatting).PSObject.Methods[$target].Invoke($format.Address, $format.IconType) $rule.Reverse = $format.Reverse } @@ -392,7 +392,7 @@ function Export-Excel { $Range=$targetConditionalText.Range if(!$Range) { $Range=$ws.Dimension.Address } - $rule=($ws.Cells[$Range].ConditionalFormatting).$target() + $rule=($ws.Cells[$Range].ConditionalFormatting).PSObject.Methods[$target].Invoke() if($targetConditionalText.Text) { if($targetConditionalText.ConditionalType -match "equal|notequal|lessthan|lessthanorequal|greaterthan|greaterthanorequal") { From 1cd583ca12a6407ec578601146aa3f5edc357d6d Mon Sep 17 00:00:00 2001 From: headsphere Date: Tue, 27 Sep 2016 11:06:50 +0100 Subject: [PATCH 2/2] Update Export-Excel.ps1 --- Export-Excel.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 72e0d66d..fb92df83 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -78,7 +78,7 @@ function Export-Excel { foreach($format in $ConditionalFormat ) { $target = "Add$($format.Formatter)" - $rule = ($ws.ConditionalFormatting).PSObject.Methods[$target].Invoke($format.Address, $format.IconType) + $rule = ($ws.ConditionalFormatting).PSObject.Methods[$target].Invoke($format.Range, $format.IconType) $rule.Reverse = $format.Reverse }