diff options
author | Attila Szűcs <szucs.attila3@nisz.hu> | 2020-07-16 09:34:31 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-07-17 15:54:46 +0200 |
commit | 2abaaf97e95bf6149378c6cd5e58cdb2ce78dc4b (patch) | |
tree | df447ecaf2e8e7d86d15c8416eef00f0ea9db92c /sc | |
parent | e12be466706d8984c0d1adcd2538fa9a950273f7 (diff) |
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@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx | bin | 0 -> 9421 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 20 | ||||
-rw-r--r-- | sc/source/filter/excel/xehelper.cxx | 7 |
3 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx Binary files differnew file mode 100644 index 000000000000..fe799886c062 --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx 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 ) |