summaryrefslogtreecommitdiff
path: root/oox/source/export/chartexport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/export/chartexport.cxx')
-rw-r--r--oox/source/export/chartexport.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 66df939d8241..389485e234f3 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2615,9 +2615,24 @@ void ChartExport::exportDataLabels(
uno::Sequence<sal_Int32> aAttrLabelIndices;
xPropSet->getPropertyValue("AttributedDataPoints") >>= aAttrLabelIndices;
+ // We must not export label placement property when the chart type doesn't
+ // support this option in MS Office, else MS Office would think the file
+ // is corrupt & refuse to open it.
bool bLabelPlacement = !mbIs3DChart;
- if (eChartType == chart::TYPEID_PIE)
- bLabelPlacement = true;
+ eChartType = getChartType();
+ switch (eChartType)
+ {
+ case chart::TYPEID_PIE:
+ // All pie charts support label placement.
+ bLabelPlacement = true;
+ break;
+ case chart::TYPEID_DOUGHNUT:
+ // Doughnut charts don't support label placement.
+ bLabelPlacement = false;
+ break;
+ default:
+ ;
+ }
const sal_Int32* p = aAttrLabelIndices.getConstArray();
const sal_Int32* pEnd = p + aAttrLabelIndices.getLength();