Added Range param for conditional text

This commit is contained in:
dfinke
2016-01-25 09:33:58 -05:00
parent a53c12d2f4
commit 408824ee66
3 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
rm .\testExport.xlsx -ErrorAction Ignore
ps | where Company | select Company, Name, PM, Handles, *mem* |
Export-Excel .\testExport.xlsx -Show -AutoSize -AutoNameRange `
-ConditionalFormat $(
New-ConditionalFormattingIconSet -Address "C:C" `
-ConditionalFormat ThreeIconSet -IconType Arrows
) -ConditionalText $(
New-ConditionalText Microsoft -ConditionalTextColor Black
New-ConditionalText Google -BackgroundColor Cyan -ConditionalTextColor Black
New-ConditionalText authors -BackgroundColor LightBlue -ConditionalTextColor Black
New-ConditionalText nvidia -BackgroundColor LightGreen -ConditionalTextColor Black
)

View File

@@ -0,0 +1,18 @@
ipmo ImportExcel -Force
$f = ".\testExport.xlsx"
rm $f -ErrorAction Ignore
function Get-DateOffset ($days=0) {
(Get-Date).AddDays($days).ToShortDateString()
}
$(
New-PSItem (Get-DateOffset -1) (Get-DateOffset 1) (echo Start End)
New-PSItem (Get-DateOffset) (Get-DateOffset 7)
New-PSItem (Get-DateOffset -10) (Get-DateOffset -1)
) |
Export-Excel $f -Show -AutoSize -AutoNameRange -ConditionalText $(
New-ConditionalText -Range Start -ConditionalType Yesterday -ConditionalTextColor Red
New-ConditionalText -Range End -ConditionalType Yesterday -BackgroundColor Blue -ConditionalTextColor Red
)

BIN
images/ConditionalDates.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB