mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-11 13:53:20 +00:00
Add TotalSettings parameter to Export-Excel
This commit is contained in:
@@ -56,6 +56,7 @@
|
|||||||
[Alias('Table')]
|
[Alias('Table')]
|
||||||
$TableName,
|
$TableName,
|
||||||
[OfficeOpenXml.Table.TableStyles]$TableStyle = [OfficeOpenXml.Table.TableStyles]::Medium6,
|
[OfficeOpenXml.Table.TableStyles]$TableStyle = [OfficeOpenXml.Table.TableStyles]::Medium6,
|
||||||
|
[HashTable]$TotalSettings,
|
||||||
[Switch]$BarChart,
|
[Switch]$BarChart,
|
||||||
[Switch]$PieChart,
|
[Switch]$PieChart,
|
||||||
[Switch]$LineChart ,
|
[Switch]$LineChart ,
|
||||||
@@ -211,7 +212,12 @@
|
|||||||
$row ++
|
$row ++
|
||||||
$null = $ws.Cells[$row, $StartColumn].LoadFromDataTable($InputObject, $false )
|
$null = $ws.Cells[$row, $StartColumn].LoadFromDataTable($InputObject, $false )
|
||||||
if ($TableName -or $PSBoundParameters.ContainsKey('TableStyle')) {
|
if ($TableName -or $PSBoundParameters.ContainsKey('TableStyle')) {
|
||||||
Add-ExcelTable -Range $ws.Cells[$ws.Dimension] -TableName $TableName -TableStyle $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 {
|
else {
|
||||||
@@ -424,7 +430,12 @@
|
|||||||
if ($null -ne $TableName -or $PSBoundParameters.ContainsKey('TableStyle')) {
|
if ($null -ne $TableName -or $PSBoundParameters.ContainsKey('TableStyle')) {
|
||||||
#Already inserted Excel table if input was a DataTable
|
#Already inserted Excel table if input was a DataTable
|
||||||
if ($InputObject -isnot [System.Data.DataTable]) {
|
if ($InputObject -isnot [System.Data.DataTable]) {
|
||||||
Add-ExcelTable -Range $ws.Cells[$dataRange] -TableName $TableName -TableStyle $TableStyle
|
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) {
|
elseif ($AutoFilter) {
|
||||||
|
|||||||
Reference in New Issue
Block a user