oox/source/export/chartexport.cxx |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit c800757494e2902395dd5f92f436e5d1ad9a695d
Author:     Aron Budea <[email protected]>
AuthorDate: Mon Jan 19 02:32:00 2026 +1030
Commit:     Mike Kaganski <[email protected]>
CommitDate: Wed Jan 21 08:13:20 2026 +0100

    oox: Limit export of dLblPos attr in pie charts to valid values
    
    Based on [MS-OI29500].
    
    This also fixes PPTX export of fdo56877-2.odp, which seems
    to have bogus content in Object 1/content.xml:
    <style:chart-properties chart:solid-type="cuboid"
    chart:label-position="left"/>
    It used to export as this invalid
    attribute: <c:dLblPos val="l"/>
    
    Change-Id: I710db739b36c469d300273ae016e3d5686b8c578
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197525
    Reviewed-by: Aron Budea <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit f10eb0f12eab9cdf1772ea2a1169e5dfce5212f9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197634
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b36499a9452e..40165e0d8323 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -5033,7 +5033,11 @@ void ChartExport::writeLabelProperties(
             if (xPropSet->getPropertyValue(u"LabelPlacement"_ustr) >>= 
nLabelPlacement)
             {
                 if (!rLabelParam.maAllowedValues.count(nLabelPlacement))
+                {
+                    SAL_WARN("oox", "this label placement not allowed in OOXML 
for current chart type: "
+                                        + OString::number(nLabelPlacement));
                     nLabelPlacement = rLabelParam.meDefault;
+                }
                 pFS->singleElement(FSNS(XML_c, XML_dLblPos), XML_val, 
toOOXMLPlacement(nLabelPlacement));
             }
         }
@@ -5097,6 +5101,8 @@ void ChartExport::exportDataLabels(
     // 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.
+    // For allowed values see 2.1.1456 Part 1 Section 21.2.2.48,
+    // dLblPos (Data Label Position) in [MS-OI29500].
 
     const chart::TypeGroupInfo& rInfo = 
chart::GetTypeGroupInfo(static_cast<chart::TypeId>(eChartType));
     LabelPlacementParam aParam(!mbIs3DChart, rInfo.mnDefLabelPos);
@@ -5106,8 +5112,16 @@ void ChartExport::exportDataLabels(
             if(getChartType() == chart::TYPEID_DOUGHNUT)
                 aParam.mbExport = false;
             else
-            // All pie charts support label placement.
-            aParam.mbExport = true;
+            {
+                // All pie charts support label placement.
+                aParam.mbExport = true;
+                aParam.maAllowedValues.clear();
+                
aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::OUTSIDE);
+                
aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::INSIDE);
+                
aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::CENTER);
+                
aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::AVOID_OVERLAP);
+                aParam.meDefault = 
css::chart::DataLabelPlacement::AVOID_OVERLAP;
+            }
         break;
         case chart::TYPEID_AREA:
         case chart::TYPEID_RADARLINE:

Reply via email to