[Libreoffice-commits] core.git: sc/qa sc/source

Attila Szűcs (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 17 15:30:36 UTC 2020


 sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx                            |   20 ++++++++++
 sc/source/filter/excel/xehelper.cxx                              |    2 -
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit ba4bc66301e0cb30379f19b9c19e320a533daa42
Author:     Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Fri Jul 17 09:21:45 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jul 17 17:29:52 2020 +0200

    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)
    
    Change-Id: Id4cba2b9188459cdaa0ade30c2217d8f59fe6316
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98938
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx b/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx
new file mode 100644
index 000000000000..224ac8d18429
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 6a40b53b9ac8..ae42341df323 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -252,6 +252,7 @@ public:
     void testTdf122331();
     void testTdf83779();
     void testTdf134459_HeaderFooterColorXLSX();
+    void testTdf134817_HeaderFooterTextWith2SectionXLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -402,6 +403,7 @@ public:
     CPPUNIT_TEST(testTdf122331);
     CPPUNIT_TEST(testTdf83779);
     CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX);
+    CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -5141,6 +5143,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());
+
+    xmlDocUniquePtr 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 b9df7b460c58..9bb3d905f1e3 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(


More information about the Libreoffice-commits mailing list