Created attachment 138459 [details] HTML with table Open the attached HTML file in Calc. The HTML was saved from the web, and contains a table. Check Sheet -> Named Ranges and Expressions -> Manage... => Three global named ranges are created for seemingly no reason: HTML_1, HTML_all, HTML_tables. And even if there's a reason, their scope shouldn't be Document (Global). Observed using LO 6.1 master build (4af729f31c64c09c76ea8bcfa5067092571b92de) & 4.0.0.3 / Ubuntu 17.04.
Created attachment 138480 [details] link to external data it's used for linking external data probably.
(In reply to raal from comment #1) > Created attachment 138480 [details] > link to external data > > it's used for linking external data probably. Notabug then?
(In reply to raal from comment #1) > it's used for linking external data probably. Fair point, I found this help page that explains the existence of names: https://help.libreoffice.org/Calc/Inserting_External_Data_in_Table_WebQuery However, the named ranges are global, while they refer to ranges on a single sheet. This is a bug in my opinion. A couple of details aren't clear to me based on the help page: - the help says the tables will be named "HTML_table1" and so on, while actually it's named "HTML_1", - what does "designate" mean? How does it work when there are multiple tables? Is it fine that "HTML_tables" refers to a single cell, A1 (in this case)?
So just to get the terminology straight (hopefully). It is OK that the scope is global. That means that you could *reference* the range from any sheet - which seems perfectly legitimate. However, the range needs to be absolute instead of relative. Thus HTML_1 should always point to the appropriate sheet, and not be different depending on which sheet is requesting the named range. In initial testing, it seems like the range might already might be absolute, but that theory didn't survive a round-trip. So forcing a sheet name for the range is necessary. The default is for a range to be absolute, so the only change to make is setting Flag3D to true so that the "Sheet#" is added to the range. void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const OUString& rName, const ScRange& rRange ) { ScComplexRefData aRefData; aRefData.InitRange( rRange ); + aRefData.Ref1.SetFlag3D(true); + aRefData.Ref2.SetFlag3D(true); https://gerrit.libreoffice.org/54725 tdf#114487
Justin Luth committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=c42b1cf2464924b125aeae15968fb79cf795bc81 tdf#114487 sc htmlimp: rangeNames should be 3D It will be available in 6.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
What should be done in a second step / follow-up commit is to set the named range's scope to sheet-local instead of global, otherwise importing a second HTML document with the same default range names would clash and the names not be added. This does *not* mean that they couldn't be referenced from other sheets, sheet-local names are definitions local to a sheet, by prefixing the sheet name can be used from any other sheet, for example Sheet2.HTML_1 (this wasn't possible in early versions with sheet-local names but is since a while already).
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-6-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=513204bcf7b9a43535ed585251e73a6d77805148&h=libreoffice-6-1 tdf#114487 sc htmlimp: rangeNames should be 3D It will be available in 6.1.0.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-6-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=cd51f388c96cafdf81303722c43c6025d9f0073e&h=libreoffice-6-0 tdf#114487 sc htmlimp: rangeNames should be 3D It will be available in 6.0.6. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=5720c85ccea9f1481bd604b806c5be728e59a13f tdf#114487 sc htmlimp: non-global sheet range names It will be available in 6.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-6-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=f62340a104813e4a6a34e7281d86407bc8314ffd&h=libreoffice-6-1 tdf#114487 sc htmlimp: non-global sheet range names It will be available in 6.1.0.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-6-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=399bf0dcd26ed23d2864d60ccba0541d81f48cdc&h=libreoffice-6-0 tdf#114487 sc htmlimp: non-global sheet range names It will be available in 6.0.6. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Since the fix for this issue has been reverted in http://cgit.freedesktop.org/libreoffice/core/commit/?id=1597dbb5ba5d68b5807236c1d045f5215f221c91, let's put it back to NEW
(In reply to Xisco Faulí from comment #12) > Since the fix for this issue has been reverted let's put it back to NEW No, the fix is the commit in comment 5. The reverted commit was just a bonus response to comment 6
(In reply to Justin L from comment #13) > (In reply to Xisco Faulí from comment #12) > > Since the fix for this issue has been reverted let's put it back to NEW > No, the fix is the commit in comment 5. The reverted commit was just a > bonus response to comment 6 oh I see, sorry for the noise. Happy to hear both bugs are fixed now!