sc/qa/unit/data/ods/tdf126305.ods |binary sc/qa/unit/subsequent_export-test.cxx | 21 +++++++++++++++++++++ sc/source/filter/excel/xecontent.cxx | 13 ++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-)
New commits: commit e8ab7f84e2d94e63f8fdae001170e5a3de3bc3de Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Tue Oct 6 12:12:29 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Wed Feb 24 16:39:52 2021 +0100 tdf#126305 XLSX export: fix data validation Error Alert Excel supports three kinds of error messages: stop, warning and information, but LO only one of error message(stop) was exported. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Iecf790c104bee39ee29629a13fe4af4d8b29d311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104021 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> (cherry picked from commit fca525d570f4fada3db1a9bbee2e88a5a02839d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111456 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/sc/qa/unit/data/ods/tdf126305.ods b/sc/qa/unit/data/ods/tdf126305.ods new file mode 100644 index 000000000000..fdff7d9568c3 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf126305.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index d387221d4156..462c63c93b42 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -265,6 +265,7 @@ public: void testTdf135828_Shape_Rect(); void testTdf123353(); void testTdf133688_precedents(); + void testTdf126305_DataValidatyErrorAlert(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -424,6 +425,7 @@ public: CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST(testTdf123353); CPPUNIT_TEST(testTdf133688_precedents); + CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); CPPUNIT_TEST_SUITE_END(); @@ -5375,6 +5377,25 @@ void ScExportTest::testTdf133688_precedents() assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0); } +void ScExportTest::testTdf126305_DataValidatyErrorAlert() +{ + ScDocShellRef xShell = loadDoc("tdf126305.", FORMAT_ODS); + CPPUNIT_ASSERT(xShell.is()); + + ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + + std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + CPPUNIT_ASSERT(pDoc); + + assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[1]", "errorStyle", "stop"); + assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[2]", "errorStyle", "warning"); + assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[3]", "errorStyle", "information"); + + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index c7d6d97ea6de..2628c8b0d1ae 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1638,6 +1638,17 @@ const char* lcl_GetOperatorType( sal_uInt32 nFlags ) return nullptr; } +const char* lcl_GetErrorType( sal_uInt32 nFlags ) +{ + switch (nFlags & EXC_DV_ERROR_MASK) + { + case EXC_DV_ERROR_STOP: return "stop"; + case EXC_DV_ERROR_WARNING: return "warning"; + case EXC_DV_ERROR_INFO: return "information"; + } + return nullptr; +} + } // namespace XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : @@ -1845,7 +1856,7 @@ void XclExpDV::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement( XML_dataValidation, XML_allowBlank, ToPsz( ::get_flag( mnFlags, EXC_DV_IGNOREBLANK ) ), XML_error, XESTRING_TO_PSZ( maErrorText ), - // OOXTODO: XML_errorStyle, + XML_errorStyle, lcl_GetErrorType(mnFlags), XML_errorTitle, XESTRING_TO_PSZ( maErrorTitle ), // OOXTODO: XML_imeMode, XML_operator, lcl_GetOperatorType( mnFlags ), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits