mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
17 lines
611 B
PowerShell
17 lines
611 B
PowerShell
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Scope='Function', Target='Set*', Justification='Does not change system state')]
|
|
param()
|
|
|
|
function Set-CellStyle {
|
|
[CmdletBinding()]
|
|
param(
|
|
$Worksheet,
|
|
$Row,
|
|
$LastColumn,
|
|
[OfficeOpenXml.Style.ExcelFillStyle]$Pattern,
|
|
$Color
|
|
)
|
|
if ($Color -is [string]) {$Color = [System.Drawing.Color]::$Color }
|
|
$t=$Worksheet.Cells["A$($Row):$($LastColumn)$($Row)"]
|
|
$t.Style.Fill.PatternType=$Pattern
|
|
$t.Style.Fill.BackgroundColor.SetColor($Color)
|
|
} |