Merge pull request #2 from ili101/xml

EPPlus empty row on an empty table
This commit is contained in:
jhoneill
2019-11-19 11:39:03 +00:00
committed by GitHub

View File

@@ -632,6 +632,10 @@
#Insert as a table, if Tablestyle didn't arrive as a default, or $TableName non-null - even if empty
if ($null -ne $TableName -or $PSBoundParameters.ContainsKey("TableStyle")) {
$null = $ws.Cells[$row,$StartColumn].LoadFromDataTable($InputObject, (-not $noHeader),$TableStyle )
# Workaround for EPPlus not marking the empty row on an empty table as dummy row.
if ($InputObject.Rows.Count -eq 0) {
($ws.Tables | Select-Object -Last 1).TableXml.table.SetAttribute('insertRow', 1)
}
}
else {
$null = $ws.Cells[$row,$StartColumn].LoadFromDataTable($InputObject, (-not $noHeader) )