diff options
author | Attila Szűcs <szucs.attila3@nisz.hu> | 2020-07-17 09:21:45 +0200 |
---|---|---|
committer | Gabor Kelemen <kelemen.gabor2@nisz.hu> | 2020-07-31 19:42:35 +0200 |
commit | 5fa0f639b8ab33aefe8f87b7125c7fe637374c55 (patch) | |
tree | 7b955e768d2ffad04c03292f0ad5d3c4e5c8492f | |
parent | a8856d9b32c23151c7031282ba87dcdda4bbad89 (diff) |
tdf#134817 XLSX export: fix partially lost header/footer
When header/footer text contain text portions with different
font setting, only the last text portion was exported.
Co-authored-by: Tibor Nagy (NISZ)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98938
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit ba4bc66301e0cb30379f19b9c19e320a533daa42)
Change-Id: Id4cba2b9188459cdaa0ade30c2217d8f59fe6316
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99849
Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx | bin | 0 -> 9382 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 20 | ||||
-rw-r--r-- | sc/source/filter/excel/xehelper.cxx | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx b/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx Binary files differnew file mode 100644 index 000000000000..224ac8d18429 --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1d0a3c83ee54..71503f9d8ad6 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -233,6 +233,7 @@ public: void testTdf128976(); void testTdf120502(); void testTdf134459_HeaderFooterColorXLSX(); + void testTdf134817_HeaderFooterTextWith2SectionXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -366,6 +367,7 @@ public: CPPUNIT_TEST(testTdf128976); CPPUNIT_TEST(testTdf120502); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); + CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4648,6 +4650,24 @@ void ScExportTest::testTdf134459_HeaderFooterColorXLSX() xDocSh->DoClose(); } +void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX() +{ + // Header/footer text with multiple selection should be exported, and imported properly + ScDocShellRef xShell = loadDoc("tdf134817_HeaderFooterTextWith2Section.", FORMAT_XLSX); + CPPUNIT_ASSERT(xShell.is()); + + ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + CPPUNIT_ASSERT(pDoc); + + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&L&\"Abadi,Regular\"&11aaa&\"Bembo,Regular\"&20bbb"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&R&\"Cambria,Regular\"&14camb&\"Dante,Regular\"&18dant"); + + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 4e0cdc58f275..61eb0ec3d776 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -739,7 +739,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico (aFontData.mbItalic != aNewData.mbItalic); if( bNewFont || (bNewStyle && pFontList) ) { - aParaText = "&\"" + aNewData.maName; + aParaText.append("&\"").append(aNewData.maName); if( pFontList ) { FontMetric aFontMetric( pFontList->Get( |