mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Add Excel style example
This commit is contained in:
22
Examples/Styles/NewExcelStyle.ps1
Normal file
22
Examples/Styles/NewExcelStyle.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
try { . $PSScriptRoot\..\..\LoadPSD1.ps1 } catch { }
|
||||
|
||||
$xlfile = "$env:TEMP\test.xlsx"
|
||||
Remove-Item $xlfile -ErrorAction SilentlyContinue
|
||||
|
||||
$data = ConvertFrom-Csv @"
|
||||
Region,Item,TotalSold
|
||||
North,melon,38
|
||||
South,screwdriver,21
|
||||
South,peach,33
|
||||
South,saw,81
|
||||
South,kiwi,70
|
||||
North,orange,59
|
||||
North,avocado,25
|
||||
South,lime,48
|
||||
South,nail,83
|
||||
North,apple,2
|
||||
"@
|
||||
|
||||
$reportTitle = "This is a report Title"
|
||||
$style = New-ExcelStyle -BackgroundColor LightBlue -FontSize 14 -Bold -Range "A1:H1" -HorizontalAlignment Center -Merge
|
||||
$data | Export-Excel $xlfile -Show -AutoSize -AutoFilter -Title $reportTitle -Style $style
|
||||
Reference in New Issue
Block a user