diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-10 15:18:07 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-11 08:26:18 +0200 |
commit | 577b95f4d0cc1cf8836ff35fc30189c64fefb508 (patch) | |
tree | de05d1310ae8402d8e41a39be4266c28e758f70d /sc/source/filter/excel | |
parent | f315fee54eee57e6e55e5fcacf2522534682c2ce (diff) |
tdf#124651: always write "name" attribute to dataField element
Despite being optional as per ECMA-376-1:2016, Excel 2016 seems to
require the presence of "name" attribute in dataField element of
pivot table definition, so make sure to write at least empty string
there.
Change-Id: Iaab5674f86b7dd0b267776678e11af47086635d7
Reviewed-on: https://gerrit.libreoffice.org/70522
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r-- | sc/source/filter/excel/xepivotxml.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 1a47e2cfeb5b..69c98d13c55b 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -947,9 +947,12 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP assert(aCachedDims[nDimIdx]); // the loop above should have screened for NULL's. const ScDPSaveDimension& rDim = *rDataField.mpDim; const boost::optional<OUString> & pName = rDim.GetLayoutName(); + // tdf#124651: despite being optional in CT_DataField according to ECMA-376 Part 1, + // Excel (at least 2016) seems to insist on the presence of "name" attribute in + // dataField element, even if empty + const OString sName = pName ? pName->toUtf8() : ""; pPivotStrm->write("<")->writeId(XML_dataField); - if (pName) - rStrm.WriteAttributes(XML_name, pName->toUtf8(), FSEND); + rStrm.WriteAttributes(XML_name, sName, FSEND); rStrm.WriteAttributes(XML_fld, OString::number(nDimIdx).getStr(), FSEND); |