diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index 4fd8638..0101f0c 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -350,8 +350,11 @@ function Export-Excel { $chart.Legend.Remove() } #$chart.Datalabel.ShowLegendKey = $true - $chart.Datalabel.ShowCategory = $chartDef.ShowCategory - $chart.Datalabel.ShowPercent = $chartDef.ShowPercent + + if ($chart.Datalabel -ne $null) { + $chart.Datalabel.ShowCategory = $chartDef.ShowCategory + $chart.Datalabel.ShowPercent = $chartDef.ShowPercent + } $chart.SetPosition($chartDef.Row, $chartDef.RowOffsetPixels,$chartDef.Column, $chartDef.ColumnOffsetPixels) $chart.SetSize($chartDef.Width, $chartDef.Height)