mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-20 10:13:16 +00:00
Add TotalSettings parameter to Export-Excel
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
[Alias('Table')]
|
||||
$TableName,
|
||||
[OfficeOpenXml.Table.TableStyles]$TableStyle = [OfficeOpenXml.Table.TableStyles]::Medium6,
|
||||
[HashTable]$TotalSettings,
|
||||
[Switch]$BarChart,
|
||||
[Switch]$PieChart,
|
||||
[Switch]$LineChart ,
|
||||
@@ -211,9 +212,14 @@
|
||||
$row ++
|
||||
$null = $ws.Cells[$row, $StartColumn].LoadFromDataTable($InputObject, $false )
|
||||
if ($TableName -or $PSBoundParameters.ContainsKey('TableStyle')) {
|
||||
if ($PSBoundParameters.ContainsKey('TotalSettings')) {
|
||||
Add-ExcelTable -Range $ws.Cells[$ws.Dimension] -TableName $TableName -TableStyle $TableStyle -TotalSettings $TotalSettings
|
||||
}
|
||||
Else {
|
||||
Add-ExcelTable -Range $ws.Cells[$ws.Dimension] -TableName $TableName -TableStyle $TableStyle
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
#Change TableName if $TableName is non-empty; don't leave caller with a renamed table!
|
||||
$orginalTableName = $InputObject.TableName
|
||||
@@ -424,9 +430,14 @@
|
||||
if ($null -ne $TableName -or $PSBoundParameters.ContainsKey('TableStyle')) {
|
||||
#Already inserted Excel table if input was a DataTable
|
||||
if ($InputObject -isnot [System.Data.DataTable]) {
|
||||
if ($PSBoundParameters.ContainsKey('TotalSettings')) {
|
||||
Add-ExcelTable -Range $ws.Cells[$dataRange] -TableName $TableName -TableStyle $TableStyle -TotalSettings $TotalSettings
|
||||
}
|
||||
else {
|
||||
Add-ExcelTable -Range $ws.Cells[$dataRange] -TableName $TableName -TableStyle $TableStyle
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($AutoFilter) {
|
||||
try {
|
||||
$ws.Cells[$dataRange].AutoFilter = $true
|
||||
|
||||
Reference in New Issue
Block a user