mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Add scriptblock for Cell Fill Style
This commit is contained in:
19
Examples/FormatCellStyles/ApplyFormatInScriptBlock.ps1
Normal file
19
Examples/FormatCellStyles/ApplyFormatInScriptBlock.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
Get-Process |
|
||||
Select-Object Company,Handles,PM, NPM|
|
||||
Export-Excel $xlfile -Show -AutoSize -CellStyleSB {
|
||||
param(
|
||||
$workSheet,
|
||||
$totalRows,
|
||||
$lastColumn
|
||||
)
|
||||
|
||||
Set-CellStyle $workSheet 1 $LastColumn Solid Cyan
|
||||
|
||||
foreach($row in (2..$totalRows | Where-Object {$_ % 2 -eq 0})) {
|
||||
Set-CellStyle $workSheet $row $LastColumn Solid Gray
|
||||
}
|
||||
|
||||
foreach($row in (2..$totalRows | Where-Object {$_ % 2 -eq 1})) {
|
||||
Set-CellStyle $workSheet $row $LastColumn Solid LightGray
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user