Bug 150312 - Named ranges disappear in Calc
Summary: Named ranges disappear in Calc
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.5.2 release
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.5.0 target:7.4.2
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-09 14:22 UTC by Vladimir Sokolinskiy
Modified: 2022-09-19 18:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Sokolinskiy 2022-08-09 14:22:55 UTC
1. Create a new Calc document with two sheets Sheet1 and Sheet2. Activate Sheet1 and add Named range:
Name: n_1
Range or Formula expression: $Sheet2.$A$1
Scope: Document (Global)

Save document as Book1.ods and close it.

2. Open Book1.ods. Delete sheet Sheet1. Save document as Book2.ods and close it.

3. Open Book2.ods. 

   It doesn't have Named Range n_1!

   Save document as Book3.ods and close it.

In my opinion, the reason is in the tag attribute table:base-cell-address.

Book1.ods:
<table:named-range table:name="n_1" table:base-cell-address="$Sheet1.$A$1" table:cell-range-address="$Sheet2.$A$1"/>

Book2.ods:
<table:named-range table:name="n_1" table:base-cell-address="" table:cell-range-address="$Sheet2.$A$1"/>

Book3.ods does not contain these tags.
Comment 1 Timur 2022-08-10 07:38:51 UTC
No repro with 7.3 or 7.5+. 
Vladimir, do not add devs yourself.
Instead, check your steps and wait for confirmation.
Comment 2 Mike Kaganski 2022-08-10 09:37:43 UTC
Repro exactly as explained in comment 0, using Version: 7.4.0.2 (x64) / LibreOffice Community
Build ID: 1512ce97d7ed39dce3121f7e15651fd8895f950e
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

To clarify a possible confusion: step #1 involves Sheet->Named Ranges and Expressions->Define..., while staying on Sheet1.

Timur: this bug was created as a result of discussion in https://ask.libreoffice.org/t/named-ranges-disappear-in-calc/79464/36; so the devs participated there (erAck and me) were added to the created issue.

Vladimir: it is best to mention the context in the bug description, like "Ref: URL", or putting the URL to the respective metadata.
Comment 3 Timur 2022-08-10 10:21:43 UTC
Thanks Mike. I reproduce now. Steps are really OK, I first didn't stay on Sheet1.
Comment 4 Vladimir Sokolinskiy 2022-08-10 10:41:19 UTC
Colleagues, thank you for your attention to the topic and clarifications!
Comment 5 Commit Notification 2022-09-09 13:55:05 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9a6c350d8dff4b5228ec7451006115e387f819f2

Resolves: tdf#150312 Move base-cell-address to a valid sheet upon deletion

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2022-09-09 13:55:15 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6afb3232d32f1ebad0cefb94c145922e217526bd

tdf#150312 unit test

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2022-09-09 14:01:25 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5a1bd80e0d685bbd76de2ebfaa1c6b0380d528f4

Related: tdf#150312 "Repair" broken table:base-cell-address of defined names

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Vladimir Sokolinskiy 2022-09-09 14:06:56 UTC
Eike, thank you so much!
Comment 9 Eike Rathke 2022-09-09 14:13:15 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/139659 for 7-4
Comment 10 Commit Notification 2022-09-09 16:44:20 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d2c500fb40be23aa7bd1d2b7cc02e47ea109d25c

Related: tdf#150312 Assert a defined name's non-empty table:base-cell-address

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2022-09-19 18:20:07 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/98516c7698aa5a492c4e59b4dc6d29815ae77327

Resolves: tdf#150312 Move base-cell-address to a valid sheet upon deletion

It will be available in 7.4.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.