mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-17 00:33:58 +00:00
tweaked
This commit is contained in:
@@ -123,7 +123,7 @@ function Export-Excel {
|
|||||||
ps | Export-Excel .\test.xlsx -WorkSheetname Processes -ChartType PieExploded3D -IncludePivotChart -IncludePivotTable -Show -PivotRows Company -PivotData PM
|
ps | Export-Excel .\test.xlsx -WorkSheetname Processes -ChartType PieExploded3D -IncludePivotChart -IncludePivotTable -Show -PivotRows Company -PivotData PM
|
||||||
.Example
|
.Example
|
||||||
Remove-Item "c:\temp\test.xlsx" -ErrorAction Ignore
|
Remove-Item "c:\temp\test.xlsx" -ErrorAction Ignore
|
||||||
Get-Service | Export-Excel "c:\temp\test.xlsx" -Show -IncludePivotTable -PivotRows status, name -PivotData status
|
Get-Service | Export-Excel "c:\temp\test.xlsx" -Show -IncludePivotTable -PivotRows status -PivotData @{status='count'}
|
||||||
#>
|
#>
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
@@ -159,7 +159,7 @@ function Export-Excel {
|
|||||||
try {
|
try {
|
||||||
$Path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
|
$Path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
|
||||||
if (Test-Path $path) {
|
if (Test-Path $path) {
|
||||||
Write-Debug "File `"$Path`" already exists"
|
Write-Debug "File `"$Path`" already exists"
|
||||||
}
|
}
|
||||||
$pkg = New-Object OfficeOpenXml.ExcelPackage $Path
|
$pkg = New-Object OfficeOpenXml.ExcelPackage $Path
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ function Export-Excel {
|
|||||||
$startAddress=$ws.Dimension.Start.Address
|
$startAddress=$ws.Dimension.Start.Address
|
||||||
$dataRange="{0}:{1}" -f $startAddress, $ws.Dimension.End.Address
|
$dataRange="{0}:{1}" -f $startAddress, $ws.Dimension.End.Address
|
||||||
Write-Debug "Data Range $dataRange"
|
Write-Debug "Data Range $dataRange"
|
||||||
|
|
||||||
if (-not [string]::IsNullOrEmpty($RangeName)) {
|
if (-not [string]::IsNullOrEmpty($RangeName)) {
|
||||||
$ws.Names.Add($RangeName, $ws.Cells[$dataRange]) | Out-Null
|
$ws.Names.Add($RangeName, $ws.Cells[$dataRange]) | Out-Null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user