[Libreoffice-commits] core.git: sc/qa sc/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 24 13:11:31 UTC 2019
sc/qa/unit/data/xlsx/tdf79972.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 18 ++++++++++++++++++
sc/source/filter/excel/xetable.cxx | 13 +++++++++++++
3 files changed, 31 insertions(+)
New commits:
commit ff634cf62a663c1e6e744cedf26d9746b235721d
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Fri May 24 09:48:35 2019 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri May 24 15:09:59 2019 +0200
tdf#79972 XLSX export: fix hyperlink at numeric data
Hyperlink at numeric data lost after export.
tdf79972.xlsx: Test file from Excel 2016.
Change-Id: I6064724e6e38325386c4dfc8f1e9d93cce041975
Reviewed-on: https://gerrit.libreoffice.org/72894
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
Tested-by: Jenkins
diff --git a/sc/qa/unit/data/xlsx/tdf79972.xlsx b/sc/qa/unit/data/xlsx/tdf79972.xlsx
new file mode 100644
index 000000000000..49f797cce41a
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf79972.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index ef7346967397..94bfd5ae4f36 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -222,6 +222,7 @@ public:
void testTdf112567();
void testTdf123645XLSX();
void testTdf125173XLSX();
+ void testTdf79972XLSX();
void testXltxExport();
@@ -349,6 +350,7 @@ public:
CPPUNIT_TEST(testTdf112567);
CPPUNIT_TEST(testTdf123645XLSX);
CPPUNIT_TEST(testTdf125173XLSX);
+ CPPUNIT_TEST(testTdf79972XLSX);
CPPUNIT_TEST(testXltxExport);
@@ -4370,6 +4372,22 @@ void ScExportTest::testTdf125173XLSX()
assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
}
+void ScExportTest::testTdf79972XLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("tdf79972.", 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", "A1");
+
+ 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/show_bug.cgi?id=79972");
+ 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 e236a795f72d..c8a34cd89faf 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -24,6 +24,8 @@
#include <com/sun/star/i18n/ScriptType.hpp>
#include <scitems.hxx>
#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/flditem.hxx>
#include <document.hxx>
#include <dociter.hxx>
#include <olinetab.hxx>
@@ -2522,6 +2524,17 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
{
double fValue = rScCell.mfValue;
+ 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);
+ }
+ }
+
// try to create a Boolean cell
if( pPattern && ((fValue == 0.0) || (fValue == 1.0)) )
{
More information about the Libreoffice-commits
mailing list