[Libreoffice-commits] core.git: sc/qa sc/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 26 11:55:31 UTC 2021
sc/qa/unit/data/ods/tdf143220.ods |binary
sc/qa/unit/subsequent_export-test2.cxx | 15 +++++++++++++++
sc/source/filter/excel/xecontent.cxx | 8 +++++---
3 files changed, 20 insertions(+), 3 deletions(-)
New commits:
commit 3c3b9ad8886da916027f0fb940a2df822d63d4d7
Author: Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Wed Jul 14 14:57:00 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon Jul 26 13:54:57 2021 +0200
tdf#143220 XLSX export: fix hyperlink to sheet target
Hyperlink to another sheet didn't work in Excel.
Change-Id: Ic63e581d5de8f7ff1eac50a5e56a51d7ba2e72ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118935
Tested-by: Jenkins
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sc/qa/unit/data/ods/tdf143220.ods b/sc/qa/unit/data/ods/tdf143220.ods
new file mode 100644
index 000000000000..6aa1536eae8e
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf143220.ods differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index 030e4a4ae7df..6ee07223a824 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -194,6 +194,7 @@ public:
void testButtonFormControlXlsxExport();
void testTdf142929_filterLessThanXLSX();
void testInvalidNamedRange();
+ void testTdf143220XLSX();
CPPUNIT_TEST_SUITE(ScExportTest2);
@@ -296,6 +297,7 @@ public:
CPPUNIT_TEST(testButtonFormControlXlsxExport);
CPPUNIT_TEST(testTdf142929_filterLessThanXLSX);
CPPUNIT_TEST(testInvalidNamedRange);
+ CPPUNIT_TEST(testTdf143220XLSX);
CPPUNIT_TEST_SUITE_END();
@@ -2460,6 +2462,19 @@ void ScExportTest2::testInvalidNamedRange()
CPPUNIT_ASSERT(!xNamedRanges->hasByName("myname"));
}
+void ScExportTest2::testTdf143220XLSX()
+{
+ ScDocShellRef xDocSh = loadDoc(u"tdf143220.", FORMAT_ODS);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ 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");
+
+ xDocSh->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 0848745b8d4a..0a7a3baeb953 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -428,15 +428,17 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" );
}
- if(nSepPos != -1)
+ if (nSepPos != -1)
{
- OUString aSheetName( aTextMark.copy(0, nSepPos));
+ OUString aSheetName(aTextMark.copy(0, nSepPos));
- if ( aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'')
+ if (aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'')
{
aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, "'");
}
}
+ else
+ aTextMark += "!A1"; // tdf#143220 link to sheet not valid without cell reference
mxTextMark.reset( new XclExpString( aTextMark, XclStrFlags::ForceUnicode, 255 ) );
}
More information about the Libreoffice-commits
mailing list