diff options
-rw-r--r-- | sc/qa/unit/data/ods/tdf143220.ods | bin | 9597 -> 10016 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test2.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/sc/qa/unit/data/ods/tdf143220.ods b/sc/qa/unit/data/ods/tdf143220.ods Binary files differindex 6aa1536eae8e..281c25626ed5 100644 --- a/sc/qa/unit/data/ods/tdf143220.ods +++ b/sc/qa/unit/data/ods/tdf143220.ods diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 361ab683a7f3..2a3a1de1b6f7 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -198,7 +198,7 @@ public: void testTdf142854_GridVisibilityImportXlsxInHeadlessMode(); void testTdf140431(); void testTdf142929_filterLessThanXLSX(); - void testTdf143220XLSX(); + void testHyperlinkLocationXLSX(); void testTdf142264ManyChartsToXLSX(); void testTdf143929MultiColumnToODS(); void testTdf142578(); @@ -302,7 +302,7 @@ public: CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); - CPPUNIT_TEST(testTdf143220XLSX); + CPPUNIT_TEST(testHyperlinkLocationXLSX); CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); CPPUNIT_TEST(testTdf143929MultiColumnToODS); CPPUNIT_TEST(testTdf142578); @@ -2464,7 +2464,7 @@ void ScExportTest2::testTdf142929_filterLessThanXLSX() xDocSh->DoClose(); } -void ScExportTest2::testTdf143220XLSX() +void ScExportTest2::testHyperlinkLocationXLSX() { ScDocShellRef xDocSh = loadDoc(u"tdf143220.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); @@ -2472,7 +2472,13 @@ void ScExportTest2::testTdf143220XLSX() xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", "Sheet2!A1"); + + // tdf#143220 link to sheet not valid without cell reference + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A1']", "location", "Sheet2!A1"); + + // tdf#145079 link with defined name target didn't work because Calc added "A1" at the end + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A2']", "location", "name"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A3']", "location", "db"); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 0a7a3baeb953..3255607bc910 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -438,7 +438,11 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU } } else - aTextMark += "!A1"; // tdf#143220 link to sheet not valid without cell reference + { + SCTAB nTab; + if (rRoot.GetDoc().GetTable(aTextMark, nTab)) + aTextMark += "!A1"; // tdf#143220 link to sheet not valid without cell reference + } mxTextMark.reset( new XclExpString( aTextMark, XclStrFlags::ForceUnicode, 255 ) ); } |