mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Added Range param for conditional text
This commit is contained in:
15
Examples/ConditionalFormatting/GetProcess.ps1
Normal file
15
Examples/ConditionalFormatting/GetProcess.ps1
Normal 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
|
||||
)
|
||||
18
Examples/ConditionalFormatting/RangeFormatting.ps1
Normal file
18
Examples/ConditionalFormatting/RangeFormatting.ps1
Normal 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
BIN
images/ConditionalDates.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 MiB |
Reference in New Issue
Block a user