tdf#123421 : xlsx export : Don't write data field entry...
commit97af58093978d8e6b9d90eedcc59141304e7200e
authorDennis Francis <dennis.francis@collabora.com>
Fri, 5 Apr 2019 16:34:13 +0000 (5 22:04 +0530)
committerAndras Timar <andras.timar@collabora.com>
Mon, 8 Apr 2019 15:55:31 +0000 (8 17:55 +0200)
tree6d197b84068b5ca7e096cd60b22e1ed61b4721da
parentea3a1b075154a665d30aaac6513812ceb839f64b
tdf#123421 : xlsx export : Don't write data field entry...

under colFields tag if there is only one data-field.

<colFields count=[*]>
    <field x="-2"/>  <--- -2 indicates data field.
</colFields>

Excel 2013/2016 seems to crash at the presence of '<field x="-2"/>'
in colFields when there is only one data-field.

Additionally, call GetOutputRangeByType(sheet::DataPilotOutputRangeType::TABLE)
on all ScDPObject's in non-const mode, so that the internal
pOuput member of ScDPObject is populated. Otherwise the
const GetOutputRangeByType(sheet::DataPilotOutputRangeType::TABLE)
call always return an invalid range.

This also adds 2 unit tests :-
1. To check the presence of <field x="-2"/> in colFields tag
   if there are more than one data-fields.
2. To ensure the absence of <field x="-2"/> in colFields tag
   if there is only one data-field.

Change-Id: I8f470bd1ab883f73586f04a3fcc30e3fbf948c4a
Reviewed-on: https://gerrit.libreoffice.org/70316
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
sc/inc/dpsave.hxx
sc/qa/unit/data/ods/tdf123421_1datafield.ods [new file with mode: 0644]
sc/qa/unit/data/ods/tdf123421_2datafields.ods [new file with mode: 0644]
sc/qa/unit/pivottable_filters_test.cxx
sc/source/filter/excel/xepivotxml.cxx