Changed TotalSettings to TableTotalSettings + Changed the way custom formulas are added + added possibility to add comments tot totals row

This commit is contained in:
Thomas Hofkens
2022-11-12 00:25:56 +01:00
parent 652a611137
commit ce49038b75
2 changed files with 41 additions and 17 deletions

View File

@@ -56,7 +56,7 @@
[Alias('Table')]
$TableName,
[OfficeOpenXml.Table.TableStyles]$TableStyle = [OfficeOpenXml.Table.TableStyles]::Medium6,
[HashTable]$TotalSettings,
[HashTable]$TableTotalSettings,
[Switch]$BarChart,
[Switch]$PieChart,
[Switch]$LineChart ,
@@ -212,8 +212,8 @@
$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
if ($PSBoundParameters.ContainsKey('TableTotalSettings')) {
Add-ExcelTable -Range $ws.Cells[$ws.Dimension] -TableName $TableName -TableStyle $TableStyle -TableTotalSettings $TableTotalSettings
}
Else {
Add-ExcelTable -Range $ws.Cells[$ws.Dimension] -TableName $TableName -TableStyle $TableStyle
@@ -430,8 +430,8 @@
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
if ($PSBoundParameters.ContainsKey('TableTotalSettings')) {
Add-ExcelTable -Range $ws.Cells[$dataRange] -TableName $TableName -TableStyle $TableStyle -TableTotalSettings $TableTotalSettings
}
else {
Add-ExcelTable -Range $ws.Cells[$dataRange] -TableName $TableName -TableStyle $TableStyle