Powershell 3.0 compatibility fix#126
Conversation
Fixed problem with conditional formatting code that was breaking in Powershell 3
|
Sorry, I haven't been able to run any of the unit tests. Please let me know if there are any problems with this! |
|
Bummer, the # Test conditional text and format
$file="C:\Temp\TestChanges.xlsx"
rm $file -ErrorAction Ignore
$data = $(
New-PSItem 1 2 3
New-PSItem 4 5 6
#New-PSItem a b c
New-PSItem 1 2 3
New-PSItem 4 5 6
)
#$ct = New-ConditionalText b
#$data | Export-Excel $file -show -ConditionalText $ct
$cf = New-ConditionalFormattingIconSet -Range "B:B" -ConditionalFormat ThreeIconSet -IconType Arrows
$data | Export-Excel $file -show -ConditionalFormat $cf |
dfinke
left a comment
There was a problem hiding this comment.
For the ConditionalFormat, I believe it should be $format.Range, that solved the error on my side. Please see if it works for you.
headsphere
left a comment
There was a problem hiding this comment.
Updated from $format.Address to $format.Range
|
That looks good to me! |
|
Thanks! Much appreciated. Question, I don't have PS v3.0 to run this on. How did this manifest itself? Did the module not load? Did it only cause errors when using the conditional sections? Did it just not produce the right results? Thanks again |
|
You get the error when loading the module. You don't need to even invoke On Wed, Sep 28, 2016 at 1:28 AM, Doug Finke notifications@github.com
Nick Head // +44 791 878 4742 // nick@headsphere.net // www.headsphere.net |
|
Thanks! Yes, PowerShell parses the target file(s) and determines what are terminating errors, even before execution. Not for everything, and I don't keep those rules in my head. :-) This is great. This clears some more hurdles for folks who have tried to use this in v3.0 |
Fixed issue #44 with conditional formatting code that was breaking in Powershell 3