Exposed ability to set a password on the sheet

This commit is contained in:
Doug Finke
2015-04-10 14:19:22 -04:00
parent 2f680fc0cb
commit 9cb16c12a3
2 changed files with 5 additions and 0 deletions

2
.gitignore vendored
View File

@@ -45,3 +45,5 @@ InstallModule.ps1
Export-Excel.ps1
testExport.xlsx
test.ps1
testPwd.xlsx
test.csv

View File

@@ -53,6 +53,7 @@ function Export-Excel {
[string[]]$PivotRows,
[string[]]$PivotColumns,
[string[]]$PivotData,
[string]$Password,
[OfficeOpenXml.Drawing.Chart.eChartType]$ChartType="Pie",
[Switch]$IncludePivotTable,
[Switch]$IncludePivotChart,
@@ -137,6 +138,7 @@ function Export-Excel {
}
}
$ws.Protection.SetPassword($Password)
$pkg.Save()
$pkg.Dispose()
@@ -151,6 +153,7 @@ function Export-MultipleExcelSheets {
$Path,
[Parameter(Mandatory)]
[hashtable]$InfoMap,
[string]$Password,
[Switch]$Show,
[Switch]$AutoSize
)