From 9051ffc0e55bcbc6d4ab07a6a81108ebaca9ba79 Mon Sep 17 00:00:00 2001 From: Kinga Kazala Date: Tue, 5 Jul 2022 15:59:32 +0200 Subject: [PATCH] example update: format both cells, plus format whole row --- Examples/ConditionalFormatting/Highlight-DiffCells.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/ConditionalFormatting/Highlight-DiffCells.ps1 b/Examples/ConditionalFormatting/Highlight-DiffCells.ps1 index 4cbffac..29f90a6 100644 --- a/Examples/ConditionalFormatting/Highlight-DiffCells.ps1 +++ b/Examples/ConditionalFormatting/Highlight-DiffCells.ps1 @@ -1,6 +1,5 @@ try { Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 } catch { throw ; return } -# Get rid of pre-exisiting sheet $xlSourcefile = "$env:TEMP\ImportExcelExample.xlsx" Write-Verbose -Verbose -Message "Save location: $xlSourcefile" @@ -21,6 +20,7 @@ South,Delaware,712,508 $excel = $data | Export-Excel $xlSourcefile -AutoSize -PassThru -Add-ConditionalFormatting -Worksheet $excel.sheet1 -Range "C2:C10" -ConditionValue '=C2=D2' -RuleType Expression -BackgroundColor Cyan +Add-ConditionalFormatting -Worksheet $excel.sheet1 -Range "C2:D10" -ConditionValue '=$C2=$D2' -RuleType Expression -BackgroundColor ([System.Drawing.Color]::Thistle) -Bold +Add-ConditionalFormatting -Worksheet $excel.sheet1 -Range "A2:D10" -ConditionValue '=$C2=$D2' -RuleType Expression -BackgroundColor ([System.Drawing.Color]::LavenderBlush) Close-ExcelPackage $excel -Show \ No newline at end of file