tdf#90828 FILESAVE:XLSX export of underline color for text inside textbox
Problem Description:
Unable to save .xlsx with underline color for text inside textbox.
Current behavior:
After RT text underline color was not exported
Expected behaviour:
After RT text underline color should export
Added export support for <a:uFill>
Change-Id: If8ffeb07f2f5e0b768689647e480792ea9c8540a
Reviewed-on: https://gerrit.libreoffice.org/15514
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9ede463..d2691cc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1362,6 +1362,15 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
WriteSolidFill( color );
}
if( GETAD( CharUnderlineColor ) )
{
sal_uInt32 color = *static_cast<sal_uInt32 const *>(mAny.getValue());
mpFS->startElementNS( XML_a, XML_uFill,FSEND);
WriteSolidFill( color );
mpFS->endElementNS( XML_a, XML_uFill );
}
if( GETA( CharFontName ) )
{
const char* pitch = NULL;
diff --git a/sc/qa/unit/data/xlsx/underlineColor.xlsx b/sc/qa/unit/data/xlsx/underlineColor.xlsx
new file mode 100644
index 0000000..30346ce
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/underlineColor.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 4924adc..4256253 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -141,6 +141,7 @@ public:
void testFontSize();
void testSheetCharacterKerningSpace();
void testSheetCondensedCharacterSpace();
void testTextUnderlineColor();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -192,6 +193,7 @@ public:
CPPUNIT_TEST(testFontSize);
CPPUNIT_TEST(testSheetCharacterKerningSpace);
CPPUNIT_TEST(testSheetCondensedCharacterSpace);
CPPUNIT_TEST(testTextUnderlineColor);
CPPUNIT_TEST_SUITE_END();
@@ -2595,6 +2597,21 @@ void ScExportTest::testSheetCondensedCharacterSpace()
xDocSh->DoClose();
}
void ScExportTest::testTextUnderlineColor()
{
ScDocShellRef xDocSh = loadDoc("underlineColor.", XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, "xl/drawings/drawing1.xml", XLSX);
CPPUNIT_ASSERT(pDoc);
OUString color = getXPath(pDoc,
"/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/a:solidFill/a:srgbClr", "val");
// make sure that the underline color is RED
CPPUNIT_ASSERT(color.equals("ff0000"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();