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

Attila Szűcs (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 17 13:55:28 UTC 2020


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

New commits:
commit 2abaaf97e95bf6149378c6cd5e58cdb2ce78dc4b
Author:     Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Thu Jul 16 09:34:31 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jul 17 15:54:46 2020 +0200

    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>

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 cfdaebe86902..6a40b53b9ac8 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -251,6 +251,7 @@ public:
     void testTdf81470();
     void testTdf122331();
     void testTdf83779();
+    void testTdf134459_HeaderFooterColorXLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -400,6 +401,7 @@ public:
     CPPUNIT_TEST(testTdf81470);
     CPPUNIT_TEST(testTdf122331);
     CPPUNIT_TEST(testTdf83779);
+    CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -5121,6 +5123,24 @@ void ScExportTest::testTdf83779()
     xShell->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");
+
+    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 6584c314aae5..b9df7b460c58 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