sc/qa/unit/data/xlsx/hyperlink_formula.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 18 ++++++++++++++++++ sc/source/filter/excel/xetable.cxx | 11 +++++++++++ 3 files changed, 29 insertions(+)
New commits: commit 1bdbdc6ebcdba2784dcfa56b50632c4706ba14b5 Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Thu Jun 20 16:52:20 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Jun 21 15:18:56 2019 +0200 tdf#126024 XLSX export: fix hyperlink on formula cell Hyperlink on formula cell lost after export. Change-Id: I682c8bb559b5adde84b350f79c35a2e769f106ec Reviewed-on: https://gerrit.libreoffice.org/74457 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: László Németh <nem...@numbertext.org> diff --git a/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx b/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx new file mode 100644 index 000000000000..77ae2bdc7f7b Binary files /dev/null and b/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 416fb9f32139..9d628f97faa9 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -224,6 +224,7 @@ public: void testTdf123645XLSX(); void testTdf125173XLSX(); void testTdf79972XLSX(); + void testTdf126024XLSX(); void testXltxExport(); @@ -353,6 +354,7 @@ public: CPPUNIT_TEST(testTdf123645XLSX); CPPUNIT_TEST(testTdf125173XLSX); CPPUNIT_TEST(testTdf79972XLSX); + CPPUNIT_TEST(testTdf126024XLSX); CPPUNIT_TEST(testXltxExport); @@ -4419,6 +4421,22 @@ void ScExportTest::testTdf79972XLSX() assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External"); } +void ScExportTest::testTdf126024XLSX() +{ + ScDocShellRef xDocSh = loadDoc("hyperlink_formula.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + + xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + CPPUNIT_ASSERT(pDoc); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A2"); + + xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); + CPPUNIT_ASSERT(pXmlRels); + assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", "https://bugs.documentfoundation.org/"); + assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index c8a34cd89faf..d7a3adf8f7e6 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2581,6 +2581,17 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : case CELLTYPE_FORMULA: { + if (pPattern) + { + OUString aUrl = pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue(); + if (!aUrl.isEmpty()) + { + std::shared_ptr<XclExpHyperlink> aLink; + aLink.reset(new XclExpHyperlink(GetRoot(), SvxURLField(aUrl, aUrl), aScPos)); + mxHyperlinkList->AppendRecord(aLink); + } + } + xCell.reset(new XclExpFormulaCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, *rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr)); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits