Bug 157897 - Calc: linked files adding print ranges with each update
Summary: Calc: linked files adding print ranges with each update
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.5.3.2 release
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:24.2.0 target:7.6.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2023-10-23 15:35 UTC by crxssi
Modified: 2023-11-01 23:52 UTC (History)
3 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 crxssi 2023-10-23 15:35:06 UTC
Description:
Calc is ADDING print ranges from linked files to the existing print range, instead of replacing the current print range.  This is causing duplications of the print range.


Steps to Reproduce:
If you have two spreadsheets- A and B, and A has a manually-selected print range (instead of the default of "entire-sheet"), and spreadsheet B contains a file link to A....  Each time document B is updated, it will copy in and *ADD* A's print range to the B document.  It should not do that.  It ends up creating repeating print ranges, resulting in printing multiple copies of the same sheet.

In the above example, if A has a print range of:

$A$1:$L$55

Then after one update of B, B's print range will contain:

$A$1:$L$55,$A$1:$L$55

If the user then saves the B document, it becomes a permanent part of B.  And the next time B is opened and updated, it will add yet another another like this:

$A$1:$L$55,$A$1:$L$55,$A$1:$L$55

Actual Results:
Duplicated print range

Expected Results:
Non-duplicated print range


Reproducible: Always


User Profile Reset: No

Additional Info:
See also:  Bug 51022 which might be related?
Comment 1 crxssi 2023-10-23 15:36:48 UTC
More detailed steps to reproduce:

* Create two spreadsheets (child.ods, mother.ods)
* Open child.ods
* Fill A1:H30 with some data
* Select A1:H30
* Format -> Print Range -> Define
* Save child.ods

* Open mother.ods
* Sheet -> Insert Sheet from File
* Choose child.ods
* Check "Link" checkbox
* OK
* Save mother.ods
* Select inserted sheet
* Format -> Print Range -> Edit
  - Should show $A$1:$H$30
* Cancel
* Close mother.ods

*Open mother.ods
* Select inserted sheet
* Format -> Print Range -> Edit
(Should show $A$1:$H$30)
* Cancel
* Click banner to Allow updating external link

* Select inserted sheet
* Format -> Print Range -> Edit
  - Expected: Should show $A$1:$H$30
  - Actual: Shows duplicated range: $A$1:$H$30,$A$1:$H$30


Every time you save, close and update links, it will duplicate the print range.
Comment 2 tmacalp 2023-10-23 18:01:47 UTC
Confirming and marking as NEW.

I don't have a bibsect environment installed, but I've at least tracked it to not affecting 7.5.2, but affecting 7.5.3.  I changed the "earliest affected version" to 7.5.3.2.  

I also searched and found bug 66613, which is likely when this bug was introduced, so I've placed a see-also for that report.

I won't mess with the importance, but it's a regression, so it should probably be adjusted.
Comment 3 Andreas Heinisch 2023-10-23 18:52:44 UTC
Yep, the cause for this issue is bug 66613. I will provide a fix.
Comment 4 tmacalp 2023-10-25 18:29:53 UTC
Thanks for the quick response, Andreas.

Sorry for the hassle and thanks for all of your hard work!
Comment 5 Andreas Heinisch 2023-10-25 19:10:42 UTC
No problem! Thx for testing. Patch is here: https://gerrit.libreoffice.org/c/core/+/158365

I am still writing the test for it.
Comment 6 Commit Notification 2023-10-26 16:42:20 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/96b91357fb93028d35d70bdb52b4bac3ecbfbf57

tdf#157897 - Clear print ranges before adding additional ones

It will be available in 24.2.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 2023-11-01 23:52:07 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

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

tdf#157897 - Clear print ranges before adding additional ones

It will be available in 7.6.3.

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.