[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/qa sc/source

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 10 06:38:25 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 a5812749820d5118c3bb4297e5f785635c75f07a
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Wed Jul 14 14:57:00 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Aug 10 08:37:49 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>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120221

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 6cc0ece437d6..8a1dc168fe26 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -190,6 +190,7 @@ public:
     void testTdf142854_GridVisibilityImportXlsxInHeadlessMode();
     void testTdf140431();
     void testTdf142929_filterLessThanXLSX();
+    void testTdf143220XLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest2);
 
@@ -288,6 +289,7 @@ public:
     CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode);
     CPPUNIT_TEST(testTdf140431);
     CPPUNIT_TEST(testTdf142929_filterLessThanXLSX);
+    CPPUNIT_TEST(testTdf143220XLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2355,6 +2357,19 @@ void ScExportTest2::testTdf142929_filterLessThanXLSX()
     xDocSh->DoClose();
 }
 
+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