[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source

Attila Szűcs (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 6 09:26:29 UTC 2021


 sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx                 |   19 ++++++++++++++++++
 sc/source/filter/excel/xehelper.cxx                   |    7 ++++++
 3 files changed, 26 insertions(+)

New commits:
commit a6b993edc19890a082216407e81ebb9a41fa30d6
Author:     Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Thu Jul 16 09:34:31 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Jan 6 10:25:56 2021 +0100

    tdf#134459 XLSX export: fix missing font color in header/footer
    
    Co-authored-by: Tibor Nagy (NISZ)
    
    Change-Id: I7aacbad1c4052b2480630d0b98175b46cf2aeed0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98873
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 2abaaf97e95bf6149378c6cd5e58cdb2ce78dc4b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108852
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx
new file mode 100644
index 000000000000..fe799886c062
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 9647d0964277..a37f89d19f6a 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -258,6 +258,7 @@ public:
     void testTdf122331();
     void testTdf83779();
     void testTdf134817_HeaderFooterTextWith2SectionXLSX();
+    void testTdf134459_HeaderFooterColorXLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -410,6 +411,7 @@ public:
     CPPUNIT_TEST(testTdf122331);
     CPPUNIT_TEST(testTdf83779);
     CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX);
+    CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -5203,6 +5205,23 @@ void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf134459_HeaderFooterColorXLSX()
+{
+    // Colors in header and footer should be exported, and imported properly
+    ScDocShellRef xShell = loadDoc("tdf134459_HeaderFooterColor.", 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&Kc06040l&C&K4c3789c&Rr");
+    assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&Ll&C&K64cf5fc&R&Kcd15aar");
+
+}
+
 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 88dcabe1b58f..9bb3d905f1e3 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -780,6 +780,13 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico
                     (nTmpUnderl == EXC_FONTUNDERL_SINGLE)? aParaText.append("&U") : aParaText.append("&E");
                 }
 
+                // font color
+                aNewData.maColor = aFont.GetColor();
+                if ( !aFontData.maColor.IsRGBEqual( aNewData.maColor ) )
+                {
+                    aParaText.append("&K").append(aNewData.maColor.AsRGBHexString());
+                }
+
                 // strikeout
                 aNewData.mbStrikeout = (aFont.GetStrikeout() != STRIKEOUT_NONE);
                 if( aFontData.mbStrikeout != aNewData.mbStrikeout )


More information about the Libreoffice-commits mailing list