sc/qa/unit/data/ods/sheet_name_with_dots.ods |binary sc/qa/unit/subsequent_export-test.cxx | 13 +++++++++++++ sc/source/filter/excel/xecontent.cxx | 13 ++++++++----- 3 files changed, 21 insertions(+), 5 deletions(-)
New commits: commit 37a3af2413f9407639157caef67d7d5168230e49 Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Thu Mar 14 14:44:31 2019 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Mar 22 12:56:25 2019 +0100 tdf#114969 XLSX export: fix 'sheet.name.with.dot'!A1-like links When the sheet name/cell address separator was an exclamation mark, bad conversion of the optional dot separator replaced the last dot of the exported sheet name, resulting broken links: 'sheet.name.with!dot'!A1 Change-Id: I84fb6c8da345c144b04657ea350f1f96614071b7 Reviewed-on: https://gerrit.libreoffice.org/69272 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sc/qa/unit/data/ods/sheet_name_with_dots.ods b/sc/qa/unit/data/ods/sheet_name_with_dots.ods new file mode 100755 index 000000000000..dc5b8193fe71 Binary files /dev/null and b/sc/qa/unit/data/ods/sheet_name_with_dots.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ccd6b16ad4db..d9f5a93a8ca2 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -210,6 +210,7 @@ public: void testTdf118990(); void testTdf121612(); void testPivotCacheAfterExportXLSX(); + void testTdf114969XLSX(); void testXltxExport(); @@ -327,6 +328,7 @@ public: CPPUNIT_TEST(testTdf118990); CPPUNIT_TEST(testTdf121612); CPPUNIT_TEST(testPivotCacheAfterExportXLSX); + CPPUNIT_TEST(testTdf114969XLSX); CPPUNIT_TEST(testXltxExport); @@ -4159,6 +4161,17 @@ void ScExportTest::testPivotCacheAfterExportXLSX() xDocSh->DoClose(); } +void ScExportTest::testTdf114969XLSX() +{ + ScDocShellRef xDocSh = loadDoc("sheet_name_with_dots.", FORMAT_ODS); + CPPUNIT_ASSERT(xDocSh.is()); + + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + CPPUNIT_ASSERT(pDoc); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", "'1.1.1.1'!C1"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", "'1.1.1.1'!C2"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx old mode 100644 new mode 100755 index 84663591f51b..1bc2697aa518 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -416,11 +416,14 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU { OUString aTextMark( rUrl.copy( 1 ) ); - sal_Int32 nSepPos = aTextMark.lastIndexOf( '.' ); - if(nSepPos != -1) - aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" ); - else - nSepPos = aTextMark.lastIndexOf( '!' ); + sal_Int32 nSepPos = aTextMark.lastIndexOf( '!' ); + sal_Int32 nPointPos = aTextMark.lastIndexOf( '.' ); + // last dot is the separator, if there is no ! after it + if(nSepPos < nPointPos) + { + nSepPos = nPointPos; + aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" ); + } if(nSepPos != -1) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits