/
diev
/
dfinke-ImportExcel
Обзор
Документация
Войти
/
diev
/
dfinke-ImportExcel
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Examples/FormatCellStyles/ApplyFormatInScriptBlock.ps1
26 строк
861 B
MikeyBronowski
Standardising examples
01 июл 2020, 23:04
01 июл 2020, 23:04
8a20963
Код
Авторство
О чём код?
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" Remove-Item $xlSourcefile -ErrorAction Ignore Get-Process | Select-Object Company,Handles,PM, NPM| Export-Excel $xlSourcefile -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 } }