Get-ConditionalFormatting function added

This commit is contained in:
Kinga Kazala
2022-07-13 09:34:30 +02:00
parent 087feedde6
commit 724ed6b197

View File

@@ -2,12 +2,20 @@
# This example is using Excel generated by Highlight-DiffCells.ps1 # This example is using Excel generated by Highlight-DiffCells.ps1
# The displayed rule should be the same as in the PS script # The displayed rule should be the same as in the PS script
$xlSourcefile = "$env:TEMP.\GetConditionalFormatting.xlsx"
$excel = Open-ExcelPackage -Path $xlSourcefile
$excel.Workbook.Worksheets | ForEach-Object { function Get-ConditionalFormatting {
$wsNme= $_.Name param (
$_.ConditionalFormatting | ForEach-Object { [string] $xlSourcefile
"Add-ConditionalFormatting -Worksheet `$excel[""$wsNme""] -Range '$($_.Address)' -ConditionValue '=$($_.Formula)' -RuleType $($_.Type) " )
$excel = Open-ExcelPackage -Path $xlSourcefile
$excel.Workbook.Worksheets | ForEach-Object {
$wsNme = $_.Name
$_.ConditionalFormatting | ForEach-Object {
"Add-ConditionalFormatting -Worksheet `$excel[""$wsNme""] -Range '$($_.Address)' -ConditionValue '=$($_.Formula)' -RuleType $($_.Type) "
}
} }
} }
$xlSourcefile = "$env:TEMP.\GetConditionalFormatting.xlsx"
Get-ConditionalFormatting -xlSourcefile $xlSourcefile