You can now hide worksheets

This commit is contained in:
dfinke
2015-09-25 17:35:29 -04:00
parent c0f3394fe7
commit 9f718635b2
5 changed files with 34 additions and 4 deletions

1
.gitignore vendored
View File

@@ -54,3 +54,4 @@ ImportExcel-Copy.psm1
TryCCFmt.ps1 TryCCFmt.ps1
test.xlsx test.xlsx
testCCFMT.ps1 testCCFMT.ps1
testHide.ps1

View File

@@ -39,7 +39,8 @@ function Export-Excel {
[Switch]$BoldTopRow, [Switch]$BoldTopRow,
[string]$RangeName, [string]$RangeName,
[string]$TableName, [string]$TableName,
[Object[]]$ConditionalFormat [Object[]]$ConditionalFormat,
[string[]]$HideSheet
) )
Begin { Begin {
@@ -199,6 +200,10 @@ function Export-Excel {
#$pkg.Workbook.View.ActiveTab = $ws.SheetID #$pkg.Workbook.View.ActiveTab = $ws.SheetID
foreach($Sheet in $HideSheet) {
$pkg.Workbook.WorkSheets[$Sheet].Hidden="Hidden"
}
$pkg.Save() $pkg.Save()
$pkg.Dispose() $pkg.Dispose()

View File

@@ -4,7 +4,7 @@
RootModule = 'ImportExcel.psm1' RootModule = 'ImportExcel.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.7' ModuleVersion = '1.8'
# ID used to uniquely identify this module # ID used to uniquely identify this module
GUID = '60dd4136-feff-401a-ba27-a84458c57ede' GUID = '60dd4136-feff-401a-ba27-a84458c57ede'

View File

@@ -4,7 +4,7 @@ $p = @{
NuGetApiKey = $NuGetApiKey NuGetApiKey = $NuGetApiKey
LicenseUri = "https://github.com/dfinke/ImportExcel/blob/master/LICENSE.txt" LicenseUri = "https://github.com/dfinke/ImportExcel/blob/master/LICENSE.txt"
Tag = "Excel","EPPlus","Export","Import" Tag = "Excel","EPPlus","Export","Import"
ReleaseNote = "Apply conditional format icons to toc cells in your data" ReleaseNote = "Now you can hide worksheets using the -HideSheet paramater"
ProjectUri = "https://github.com/dfinke/ImportExcel" ProjectUri = "https://github.com/dfinke/ImportExcel"
} }

View File

@@ -24,7 +24,31 @@ Know Issues
What's new What's new
- -
#### 9/11/2015 5:37:21 PM
#### 9/25/2015
**Hide worksheets**
Got a great request from [forensicsguy20012004](https://github.com/forensicsguy20012004) to hide worksheets. You create a few pivotables, generate charts and then pivotable worksheets don't need to be visible.
`Export-Excel` now has a `-HideSheet` parameter that takes and array of worksheet names and hides them.
##### Example
Here, you create four worksheets named `PM`,`Handles`,`Services` and `Files`.
The last line creates the `Files` sheet and then hides the `Handles`,`Services`
$p = Get-Process
$p|select company, pm | Export-Excel $xlFile -WorkSheetname PM
$p|select company, handles| Export-Excel $xlFile -WorkSheetname Handles
Get-Service| Export-Excel $xlFile -WorkSheetname Services
dir -File | Export-Excel $xlFile -WorkSheetname Files -Show -HideSheet Handles, Services
**Note** There is a bug in EPPlus that does not let you hide the first worksheet created. Hopefully it'll resolved soon.
#### 9/11/2015
Added Conditional formatting. See [TryConditional.ps1](https://github.com/dfinke/ImportExcel/blob/master/TryConditional.ps1) as an example. Added Conditional formatting. See [TryConditional.ps1](https://github.com/dfinke/ImportExcel/blob/master/TryConditional.ps1) as an example.