After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779635 - Hyperlinks to defined names do not roundtrip
Hyperlinks to defined names do not roundtrip
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export OOo / OASIS
git master
Other All
: Normal normal
: ---
Assigned To: Andreas J. Guelzow
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2017-03-06 01:32 UTC by Morten Welinder
Modified: 2017-03-10 15:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
LO generated sample (11.44 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-03-06 14:15 UTC, Morten Welinder
  Details
Tentative patch (3.66 KB, patch)
2017-03-06 16:49 UTC, Morten Welinder
committed Details | Review

Description Morten Welinder 2017-03-06 01:32:37 UTC
../test/t6522-hlink.pl --subtests ods
-------------------------------------------------------------------------------
t6522-hlink.pl: Check hyperlink ods roundtrip.
--- hlink-tests.xml	2017-03-05 20:31:23.429255580 -0500
+++ hlink-tests-new.xml	2017-03-05 20:31:23.441255580 -0500
@@ -138,7 +138,7 @@
         <gnm:StyleRegion startCol="0" startRow="12" endCol="0" endRow="12">
           <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:FFFF" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
             <gnm:Font Unit="10" Bold="0" Italic="0" Underline="1" StrikeThrough="0" Script="0">Sans</gnm:Font>
-            <gnm:HyperLink type="GnmHLinkCurWB" target="NAMEDCELL" tip="NAMEDCELL&#10;Left click once to follow this link.&#10;Middle click once to select this cell"/>
+            <gnm:HyperLink type="GnmHLinkCurWB" tip="NAMEDCELL&#10;Left click once to follow this link.&#10;Middle click once to select this cell"/>
           </gnm:Style>
         </gnm:StyleRegion>
         <gnm:StyleRegion startCol="0" startRow="13" endCol="7" endRow="16">
diff died due to signal 1



What's new here is that setting the link target will now look for the name
right there and then -- not simply store a string for later parsing.
Comment 1 Andreas J. Guelzow 2017-03-06 03:02:00 UTC
Currently we write to ods:
<text:a xlink:type="simple" xlink:actuate="onRequest" xlink:href="NAMEDCELL" office:title="NAMEDCELL&#10;Left click once to follow this link.&#10;Middle click once to select this cell">NAMEDCELL</text:a>

If I understand this right then "What's new here is that setting the link target will now look for the name right there and then -- not simply store a string for later parsing" is a problem since in the ods importer we have to store the string and parse later: The definition for named ranges are virtually the very last thing in the content.xml file. But there may be other ways of handling this. We are parsing the file twice anyways...

Nevertheless, this export does not seem to work in an import to LO so there may be more wrong.
Comment 2 Morten Welinder 2017-03-06 03:26:44 UTC
Writing *ought* not to have changed.

We're crazy for actually setting that (default) tip which includes GUI
elements.  We should probably keep it NULL and generate something on
demand.  However, that's not an ODS problem.
Comment 3 Andreas J. Guelzow 2017-03-06 04:16:49 UTC
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.

We still have to look at the import of these links to LO (to make sure our export is in fact correct).
Comment 4 Morten Welinder 2017-03-06 12:41:24 UTC
For what it is worth, Excel is not happy with our generated ods files.
It strips both internal links for the sample.
Comment 5 Morten Welinder 2017-03-06 14:15:07 UTC
Created attachment 347316 [details]
LO generated sample

This file was generated from the xlsx file we produce from the hlink sample
file.  Excel seems happy with the xlsx file, so it's probably good.
Comment 6 Morten Welinder 2017-03-06 14:19:16 UTC
              <text:a xlink:href="#Sheet1.G12" xlink:type="simple">Sheet1!G12</t


              <text:a xlink:href="#NAMEDCELL" xlink:type="simple">NAMEDCELL</text:a>
Comment 7 Andreas J. Guelzow 2017-03-06 15:45:31 UTC
While the round trip test claims to PASS, that is an illusion:
saving the test file as ods and open it in Gnumeric yields a broken link.
Comment 8 Morten Welinder 2017-03-06 16:08:48 UTC
Confirmed.  That's interesting.  I'll figure out what that is all about.

For reference, this is what we create for a direct save:

              <text:a xlink:type="simple" xlink:actuate="onRequest" xlink:href="Sheet1!G12" office:title="Sheet1!G12&#10;Left click once to follow this link.&#10;Middle click once to select this cell">Sheet1!G12</text:a>
              <text:a xlink:type="simple" xlink:actuate="onRequest" xlink:href="NAMEDCELL" office:title="NAMEDCELL&#10;Left click once to follow this link.&#10;Middle click once to select this cell">NAMEDCELL</text:a>
Comment 9 Morten Welinder 2017-03-06 16:49:44 UTC
Created attachment 347324 [details] [review]
Tentative patch

This should fix scoping of names
Comment 10 Andreas J. Guelzow 2017-03-06 21:24:32 UTC
Review of attachment 347324 [details] [review]:

This looks good to me. Please commit.
Comment 11 Morten Welinder 2017-03-06 23:14:38 UTC
Comment on attachment 347324 [details] [review]
Tentative patch

Committed
Comment 12 Andreas J. Guelzow 2017-03-07 05:31:40 UTC
Interoperability with LO is now achieved. We need to test with Excel.
Comment 13 Morten Welinder 2017-03-07 13:19:37 UTC
Sheet1!G12 works, but I note that we use a different syntax than both
LO and XL do: "#Sheet1!G12" vs "#Sheet1.G12"

NAMEDCELL imports, but does not work.  I get a "References is not valid"
when clicked.  The name is simply not defined as far as Excel is concerned.
Comment 14 Morten Welinder 2017-03-07 13:23:37 UTC
Excel writes...
        <table:named-range table:name="NAMEDCELL" table:cell-range-address="Sheet1.$H$13" table:base-cell-address="Sheet1.$A$1"/>



We write...
        <table:named-range table:name="NAMEDCELL" table:cell-range-address="$'Sheet1'.$H$13" table:base-cell-address="$'Sheet1'.$A$1" table:range-usable-as="print-range filter repeat-row repeat-column"/>


The problem is
     table:range-usable-as="print-range filter repeat-row repeat-column"
With it, Excel silently ignores the name.  Without, it works.
Comment 15 Morten Welinder 2017-03-07 16:18:16 UTC
https://msdn.microsoft.com/en-us/library/jj671567(v=office.12).aspx
says that XL supports none of the tokens, not even "none".

LO doesn't write any table:range-usable-as attribute for this sheet.

Suggestion: consider this a botched part of the ODS spec and drop it.
Comment 16 Andreas J. Guelzow 2017-03-08 02:58:32 UTC
Since the table:range-usable-as attribute is optional and defaults to "none" we can leave it out. It's purpose is to indicate that this range can also be used for the named purposes. We can just leave it off.

ODF does not really give any specific format for the local portion of the xlink:href value. Writing "#Sheet1.G12" would likely be a better idea then  "#Sheet1!G12" since the former is based on the usual cell address.
Comment 17 Morten Welinder 2017-03-09 15:34:09 UTC
range-usable-as has been dropped.  Excel is happy with the resulting ods
file.
Comment 18 Morten Welinder 2017-03-10 14:57:39 UTC
We now write #Sheet1.A4 to ods files.  That reveals that we don't actually
read that syntax...
Comment 19 Morten Welinder 2017-03-10 15:03:41 UTC
Read fixed.

This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.