diff --git a/Examples/ConditionalFormatting/ConditionalText.ps1 b/Examples/ConditionalFormatting/ConditionalText.ps1 index 76d0cfa..c04c297 100644 --- a/Examples/ConditionalFormatting/ConditionalText.ps1 +++ b/Examples/ConditionalFormatting/ConditionalText.ps1 @@ -1,11 +1,13 @@ -$file = ".\conditionalTextFormatting.xlsx" -rm $file -ErrorAction Ignore +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} -Get-Service | - Select Status, Name, DisplayName, ServiceName | +$file = ".\conditionalTextFormatting.xlsx" +Remove-Item $file -ErrorAction Ignore + +Get-Service | + Select-Object Status, Name, DisplayName, ServiceName | Export-Excel $file -Show -AutoSize -AutoFilter -ConditionalText $( - New-ConditionalText stop + New-ConditionalText stop New-ConditionalText runn darkblue cyan - New-ConditionalText -ConditionalType EndsWith svc wheat green - New-ConditionalText -ConditionalType BeginsWith windows darkgreen wheat + New-ConditionalText -ConditionalType EndsWith svc wheat green + New-ConditionalText -ConditionalType BeginsWith windows darkgreen wheat ) \ No newline at end of file diff --git a/Examples/ConditionalFormatting/ContainsBlanks.ps1 b/Examples/ConditionalFormatting/ContainsBlanks.ps1 index bc6f744..83e01a4 100644 --- a/Examples/ConditionalFormatting/ContainsBlanks.ps1 +++ b/Examples/ConditionalFormatting/ContainsBlanks.ps1 @@ -1,15 +1,17 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $ContainsBlanks = New-ConditionalText -ConditionalType ContainsBlanks $data = $( New-PSItem a b c (echo p1 p2 p3) - New-PSItem + New-PSItem New-PSItem d e f - New-PSItem - New-PSItem - New-PSItem g h i + New-PSItem + New-PSItem + New-PSItem g h i ) $file ="c:\temp\testblanks.xlsx" -rm $file -ErrorAction Ignore +Remove-Item $file -ErrorAction Ignore $data | Export-Excel $file -show -ConditionalText $ContainsBlanks \ No newline at end of file diff --git a/Examples/ConditionalFormatting/Databar.ps1 b/Examples/ConditionalFormatting/Databar.ps1 index e92c332..9a87f89 100644 --- a/Examples/ConditionalFormatting/Databar.ps1 +++ b/Examples/ConditionalFormatting/Databar.ps1 @@ -1,4 +1,6 @@ -Remove-Item -Path .\test.xlsx -ErrorAction Ignore +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + +Remove-Item -Path .\test.xlsx -ErrorAction Ignore $excel = Get-Process | Select-Object -Property Name,Company,Handles,CPU,PM,NPM,WS | diff --git a/Examples/ConditionalFormatting/FormatCalculations.ps1 b/Examples/ConditionalFormatting/FormatCalculations.ps1 index 47e5fa8..f2d271b 100644 --- a/Examples/ConditionalFormatting/FormatCalculations.ps1 +++ b/Examples/ConditionalFormatting/FormatCalculations.ps1 @@ -1,11 +1,13 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore $data = $( New-PSItem North 111 (echo Region Amount ) - New-PSItem East 111 + New-PSItem East 111 New-PSItem West 122 New-PSItem South 200 @@ -14,11 +16,11 @@ $data = $( New-PSItem SouthWest 136 New-PSItem South 127 - New-PSItem NorthByNory 100 - New-PSItem NothEast 110 - New-PSItem Westerly 120 + New-PSItem NorthByNory 100 + New-PSItem NothEast 110 + New-PSItem Westerly 120 New-PSItem SouthWest 118 -) +) #$data | Export-Excel $f -Show -AutoSize -ConditionalText (New-ConditionalText -ConditionalType AboveAverage) diff --git a/Examples/ConditionalFormatting/GetProcess.ps1 b/Examples/ConditionalFormatting/GetProcess.ps1 index 2a1bcad..773c490 100644 --- a/Examples/ConditionalFormatting/GetProcess.ps1 +++ b/Examples/ConditionalFormatting/GetProcess.ps1 @@ -1,6 +1,8 @@ -rm .\testExport.xlsx -ErrorAction Ignore +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} -ps | where Company | select Company, Name, PM, Handles, *mem* | +Remove-Item .\testExport.xlsx -ErrorAction Ignore + +Get-Process | Where-Object Company | Select-Object Company, Name, PM, Handles, *mem* | Export-Excel .\testExport.xlsx -Show -AutoSize -AutoNameRange ` -ConditionalFormat $( diff --git a/Examples/ConditionalFormatting/Highlight-Last7Days.ps1 b/Examples/ConditionalFormatting/Highlight-Last7Days.ps1 index c414312..3246bd8 100644 --- a/Examples/ConditionalFormatting/Highlight-Last7Days.ps1 +++ b/Examples/ConditionalFormatting/Highlight-Last7Days.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-LastMonth.ps1 b/Examples/ConditionalFormatting/Highlight-LastMonth.ps1 index c9405f3..04d43ac 100644 --- a/Examples/ConditionalFormatting/Highlight-LastMonth.ps1 +++ b/Examples/ConditionalFormatting/Highlight-LastMonth.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-LastWeek.ps1 b/Examples/ConditionalFormatting/Highlight-LastWeek.ps1 index 112fdab..18466c0 100644 --- a/Examples/ConditionalFormatting/Highlight-LastWeek.ps1 +++ b/Examples/ConditionalFormatting/Highlight-LastWeek.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-NextMonth.ps1 b/Examples/ConditionalFormatting/Highlight-NextMonth.ps1 index 1872ec8..4d0f60c 100644 --- a/Examples/ConditionalFormatting/Highlight-NextMonth.ps1 +++ b/Examples/ConditionalFormatting/Highlight-NextMonth.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-NextWeek.ps1 b/Examples/ConditionalFormatting/Highlight-NextWeek.ps1 index a52d123..196ab22 100644 --- a/Examples/ConditionalFormatting/Highlight-NextWeek.ps1 +++ b/Examples/ConditionalFormatting/Highlight-NextWeek.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-ThisMonth.ps1 b/Examples/ConditionalFormatting/Highlight-ThisMonth.ps1 index ec7beae..85a7c81 100644 --- a/Examples/ConditionalFormatting/Highlight-ThisMonth.ps1 +++ b/Examples/ConditionalFormatting/Highlight-ThisMonth.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-ThisWeek.ps1 b/Examples/ConditionalFormatting/Highlight-ThisWeek.ps1 index 36fca34..02a4de0 100644 --- a/Examples/ConditionalFormatting/Highlight-ThisWeek.ps1 +++ b/Examples/ConditionalFormatting/Highlight-ThisWeek.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-Today.ps1 b/Examples/ConditionalFormatting/Highlight-Today.ps1 index 0d12f94..fce0ec8 100644 --- a/Examples/ConditionalFormatting/Highlight-Today.ps1 +++ b/Examples/ConditionalFormatting/Highlight-Today.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-Tomorrow.ps1 b/Examples/ConditionalFormatting/Highlight-Tomorrow.ps1 index 60292ad..d336223 100644 --- a/Examples/ConditionalFormatting/Highlight-Tomorrow.ps1 +++ b/Examples/ConditionalFormatting/Highlight-Tomorrow.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/Highlight-Yesterday.ps1 b/Examples/ConditionalFormatting/Highlight-Yesterday.ps1 index f5f0816..af53393 100644 --- a/Examples/ConditionalFormatting/Highlight-Yesterday.ps1 +++ b/Examples/ConditionalFormatting/Highlight-Yesterday.ps1 @@ -1,6 +1,8 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore .\GenDates.ps1 | Export-Excel $f -Show -AutoSize -ConditionalText $( diff --git a/Examples/ConditionalFormatting/HighlightDuplicates.ps1 b/Examples/ConditionalFormatting/HighlightDuplicates.ps1 index b21784a..5ed5627 100644 --- a/Examples/ConditionalFormatting/HighlightDuplicates.ps1 +++ b/Examples/ConditionalFormatting/HighlightDuplicates.ps1 @@ -1,23 +1,25 @@ +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} + $f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +Remove-Item $f -ErrorAction Ignore $data = $( New-PSItem North 111 (echo Region Amount ) - New-PSItem East 11 - New-PSItem West 12 - New-PSItem South 1000 + New-PSItem East 11 + New-PSItem West 12 + New-PSItem South 1000 - New-PSItem NorthEast 10 - New-PSItem SouthEast 14 - New-PSItem SouthWest 13 - New-PSItem South 12 + New-PSItem NorthEast 10 + New-PSItem SouthEast 14 + New-PSItem SouthWest 13 + New-PSItem South 12 - New-PSItem NorthByNory 100 - New-PSItem NothEast 110 - New-PSItem Westerly 120 - New-PSItem SouthWest 11 -) + New-PSItem NorthByNory 100 + New-PSItem NothEast 110 + New-PSItem Westerly 120 + New-PSItem SouthWest 11 +) $data | Export-Excel $f -Show -AutoSize -ConditionalText (New-ConditionalText -ConditionalType DuplicateValues) \ No newline at end of file diff --git a/Examples/ConditionalFormatting/RangeFormatting.ps1 b/Examples/ConditionalFormatting/RangeFormatting.ps1 index 4437aea..2ca3b60 100644 --- a/Examples/ConditionalFormatting/RangeFormatting.ps1 +++ b/Examples/ConditionalFormatting/RangeFormatting.ps1 @@ -1,16 +1,17 @@ -ipmo ImportExcel -Force -$f = ".\testExport.xlsx" -rm $f -ErrorAction Ignore +try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} -function Get-DateOffset ($days=0) { +$f = ".\testExport.xlsx" +Remove-Item $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) -) | + 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