summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2019-01-17 09:57:41 +0300
committerAndras Timar <andras.timar@collabora.com>2019-01-18 20:35:14 +0100
commit5aeeff325b98374bfbd08e9e69de4ed8ce2340cc (patch)
tree66ecf2ed9e3be0005260825fc40f848dd8c0ae1c /oox
parent78579b56ccb51ca0f011614f0549b2c9f9452eb7 (diff)
tdf#122031 Export number format of chart label to OOXML
The patch fixes missing numFmt. numFmt element has been added as child under the dLbl element. Change-Id: Ic81ac58c2ea087cd7599351034eb4298ee613843 Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/66493 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Jenkins (cherry picked from commit 102f42fa6398fa7e6bf8e9bcfa4c28c22473cd26) Reviewed-on: https://gerrit.libreoffice.org/66631 Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index a6bd3b4c0618..2f4b55fcd2d8 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3091,7 +3091,7 @@ void ChartExport::exportDataLabels(
if (GetProperty(xPropSet, "LinkNumberFormatToSource"))
mAny >>= bLinkedNumFmt;
- if (GetProperty(xPropSet, "NumberFormat"))
+ if (GetProperty(xPropSet, "NumberFormat") || GetProperty(xPropSet, "PercentageNumberFormat"))
{
sal_Int32 nKey = 0;
mAny >>= nKey;
@@ -3157,15 +3157,31 @@ void ChartExport::exportDataLabels(
const sal_Int32* p = aAttrLabelIndices.getConstArray();
const sal_Int32* pEnd = p + aAttrLabelIndices.getLength();
+
+
for (; p != pEnd; ++p)
{
sal_Int32 nIdx = *p;
uno::Reference<beans::XPropertySet> xLabelPropSet = xSeries->getDataPointByIndex(nIdx);
+
if (!xLabelPropSet.is())
continue;
- // Individual label property that overwrites the baseline.
pFS->startElement(FSNS(XML_c, XML_dLbl), FSEND);
+
+ if (GetProperty(xLabelPropSet, "NumberFormat") || GetProperty(xLabelPropSet, "PercentageNumberFormat"))
+ {
+ sal_Int32 nKey = 0;
+ mAny >>= nKey;
+
+ OUString aNumberFormatString = getNumberFormatCode(nKey);
+ OString sNumberFormatString = OUStringToOString(aNumberFormatString, RTL_TEXTENCODING_UTF8);
+
+ pFS->singleElement(FSNS(XML_c, XML_numFmt), XML_formatCode, sNumberFormatString.getStr(),
+ XML_sourceLinked, bLinkedNumFmt ? "1" : "0", FSEND);
+ }
+
+ // Individual label property that overwrites the baseline.
pFS->singleElement(FSNS(XML_c, XML_idx), XML_val, I32S(nIdx), FSEND);
exportTextProps( xPropSet );
writeLabelProperties(pFS, this, xLabelPropSet, aParam);