mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-20 10:13:16 +00:00
Added Filter, Freeze and Bold first row
This commit is contained in:
@@ -119,7 +119,10 @@ function Export-Excel {
|
|||||||
[Switch]$IncludePivotChart,
|
[Switch]$IncludePivotChart,
|
||||||
[Switch]$AutoSize,
|
[Switch]$AutoSize,
|
||||||
[Switch]$Show,
|
[Switch]$Show,
|
||||||
[Switch]$NoClobber
|
[Switch]$NoClobber,
|
||||||
|
[Switch]$FreezeTopRow,
|
||||||
|
[Switch]$AutoFilter,
|
||||||
|
[Switch]$BoldFirstRow
|
||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
@@ -230,9 +233,25 @@ function Export-Excel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($AutoSize) { $ws.Cells.AutoFitColumns() }
|
|
||||||
if($Password) { $ws.Protection.SetPassword($Password) }
|
if($Password) { $ws.Protection.SetPassword($Password) }
|
||||||
|
|
||||||
|
if($AutoFilter) {
|
||||||
|
$startAddress=$ws.Dimension.Start.Address
|
||||||
|
$range="{0}:{1}" -f $startAddress, $ws.Dimension.End.Address
|
||||||
|
$ws.Cells[$range].AutoFilter=$true
|
||||||
|
}
|
||||||
|
|
||||||
|
if($FreezeTopRow) {
|
||||||
|
$ws.View.FreezePanes(2,1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if($BoldFirstRow) {
|
||||||
|
$range=$ws.Dimension.Address -replace $ws.Dimension.Rows, "1"
|
||||||
|
$ws.Cells[$range].Style.Font.Bold=$true
|
||||||
|
}
|
||||||
|
|
||||||
|
if($AutoSize) { $ws.Cells.AutoFitColumns() }
|
||||||
|
|
||||||
$pkg.Save()
|
$pkg.Save()
|
||||||
$pkg.Dispose()
|
$pkg.Dispose()
|
||||||
|
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -19,6 +19,20 @@ Know Issues
|
|||||||
|
|
||||||
What's new
|
What's new
|
||||||
-
|
-
|
||||||
|
#### 5/17/2015
|
||||||
|
* Added three parameters:
|
||||||
|
* FreezeTopRow - Freezes the first row of the data
|
||||||
|
* AutoFilter - Enables filtering for the data in the sheet
|
||||||
|
* BoldFirstRow - Bolds the first row of data, the column headers
|
||||||
|
|
||||||
|
Example
|
||||||
|
|
||||||
|
Get-CimInstance win32_service |
|
||||||
|
select state, accept*, start*, caption |
|
||||||
|
Export-Excel test.xlsx -Show -BoldFirstRow -AutoFilter -FreezeTopRow -AutoSize
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
#### 5/4/2015
|
#### 5/4/2015
|
||||||
* Published to PowerShell Gallery. In PowerShell v5 use `Find-Module importexcel` then `Find-Module importexcel | Install-Module`
|
* Published to PowerShell Gallery. In PowerShell v5 use `Find-Module importexcel` then `Find-Module importexcel | Install-Module`
|
||||||
|
|||||||
Reference in New Issue
Block a user