oox/source/export/chartexport.cxx | 57 ++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 27 deletions(-)
New commits: commit 320a5640dec289cc936b9de51a09760d33432acd Author: Noel Grandin <[email protected]> AuthorDate: Mon Nov 3 13:32:42 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Tue Nov 4 09:44:36 2025 +0100 mso-test: c:dLbl element wrong order This is using the test document from ttdf92129-5.odt. When importing and exporting to DOCX, we were writing the dLbl before the numFormat element, instead of after it. Change-Id: I541688f2df4f879294ad56182db8eb1df6edf182 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193344 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit 5f3fca8a18aa697904a0310db22db6dab27fba67) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193383 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 9b747901129b..c0795954aab0 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -5059,33 +5059,6 @@ void ChartExport::exportDataLabels( pFS->startElement(FSNS(XML_c, XML_dLbls)); } - bool bLinkedNumFmt = true; - if (GetProperty(xPropSet, u"LinkNumberFormatToSource"_ustr)) - mAny >>= bLinkedNumFmt; - - chart2::DataPointLabel aLabel; - bool bLabelIsNumberFormat = true; - if( xPropSet->getPropertyValue(u"Label"_ustr) >>= aLabel ) - bLabelIsNumberFormat = aLabel.ShowNumber; - - if (GetProperty(xPropSet, bLabelIsNumberFormat ? u"NumberFormat"_ustr : u"PercentageNumberFormat"_ustr)) - { - sal_Int32 nKey = 0; - mAny >>= nKey; - - OUString aNumberFormatString = getNumberFormatCode(nKey); - - if (bIsChartex) { - pFS->singleElement(FSNS(XML_cx, XML_numFmt), - XML_formatCode, aNumberFormatString, - XML_sourceLinked, ToPsz10(bLinkedNumFmt)); - } else { - pFS->singleElement(FSNS(XML_c, XML_numFmt), - XML_formatCode, aNumberFormatString, - XML_sourceLinked, ToPsz10(bLinkedNumFmt)); - } - } - uno::Sequence<sal_Int32> aAttrLabelIndices; xPropSet->getPropertyValue(u"AttributedDataPoints"_ustr) >>= aAttrLabelIndices; @@ -5192,9 +5165,12 @@ void ChartExport::exportDataLabels( } } + bool bLinkedNumFmt = false; if( GetProperty(xLabelPropSet, u"LinkNumberFormatToSource"_ustr) ) mAny >>= bLinkedNumFmt; + chart2::DataPointLabel aLabel; + bool bLabelIsNumberFormat = true; if( xLabelPropSet->getPropertyValue(u"Label"_ustr) >>= aLabel ) bLabelIsNumberFormat = aLabel.ShowNumber; else @@ -5222,6 +5198,33 @@ void ChartExport::exportDataLabels( pFS->endElement(FSNS(XML_c, XML_dLbl)); } + bool bLinkedNumFmt = true; + if (GetProperty(xPropSet, u"LinkNumberFormatToSource"_ustr)) + mAny >>= bLinkedNumFmt; + + chart2::DataPointLabel aLabel; + bool bLabelIsNumberFormat = true; + if( xPropSet->getPropertyValue(u"Label"_ustr) >>= aLabel ) + bLabelIsNumberFormat = aLabel.ShowNumber; + + if (GetProperty(xPropSet, bLabelIsNumberFormat ? u"NumberFormat"_ustr : u"PercentageNumberFormat"_ustr)) + { + sal_Int32 nKey = 0; + mAny >>= nKey; + + OUString aNumberFormatString = getNumberFormatCode(nKey); + + if (bIsChartex) { + pFS->singleElement(FSNS(XML_cx, XML_numFmt), + XML_formatCode, aNumberFormatString, + XML_sourceLinked, ToPsz10(bLinkedNumFmt)); + } else { + pFS->singleElement(FSNS(XML_c, XML_numFmt), + XML_formatCode, aNumberFormatString, + XML_sourceLinked, ToPsz10(bLinkedNumFmt)); + } + } + // Baseline label properties for all labels. writeLabelProperties(pFS, this, xPropSet, aParam, -1, rDLblsRange, bIsChartex);
