From 458a08dab04cfc5a89700e5fa9eb607c8d4aeb25 Mon Sep 17 00:00:00 2001 From: dfinke Date: Thu, 21 Dec 2017 09:33:14 -0500 Subject: [PATCH] Add example to set the background color of a cloumn --- .../SetColumnBackgroundColor.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Examples/SetColumnBackgroundColor/SetColumnBackgroundColor.ps1 diff --git a/Examples/SetColumnBackgroundColor/SetColumnBackgroundColor.ps1 b/Examples/SetColumnBackgroundColor/SetColumnBackgroundColor.ps1 new file mode 100644 index 0000000..67d3738 --- /dev/null +++ b/Examples/SetColumnBackgroundColor/SetColumnBackgroundColor.ps1 @@ -0,0 +1,9 @@ + +$p = ps | select Company, Handles | Export-Excel c:\temp\testBackgroundColor.xlsx -ClearSheet -KillExcel -PassThru + +$ws = $p.Workbook.WorkSheets[1] +$totalRows = $ws.Dimension.Rows + +Set-Format -Address $ws.Cells["B2:B$($totalRows)"] -BackgroundColor LightBlue + +Export-Excel -ExcelPackage $p -show \ No newline at end of file