Bug 51022 - Print range lost on file save/reopen if the file contains external link
Summary: Print range lost on file save/reopen if the file contains external link
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: Other Windows (All)
: medium major
Assignee: Attila Szűcs
URL:
Whiteboard: target:7.2.0 target:7.1.1
Keywords:
: 47592 77021 129960 137232 (view as bug list)
Depends on:
Blocks: Print-Range
  Show dependency treegraph
 
Reported: 2012-06-12 23:53 UTC by HD
Modified: 2021-07-29 14:52 UTC (History)
9 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 HD 2012-06-12 23:53:07 UTC
Reproduced with LibreOffice 3.4.5, 3.5.4 on XP and Win 7.
It worked fine with OpenOffice.org 3.2.1 and 3.3.0.

If a Calc file contains an external link, print range at last sheet is
lost when saved and reopened. And as I stated, whether the file has 2
sheets, 3 sheets or 10 sheets, only the last sheet of the document is
affected by this bug.

It can be reproduced with a new document, and reproducible everytime.

Steps to reproduce:
1. Create 2 new Calc files. (A.ods, B.ods)
2. Open A.ods and enter a data into A1 of Sheet1 and save.
3. Open B.ods and insert an external link at A1 of Sheet 1 to refer
   the data entered to A.ods at step 2.
4. Enter data to the remaining sheets of B.ods so all sheets have
   print range each.
5. Save B.ods, close and reopen.
6. Print range at last sheet is lost.

If I open the file saved at the above step 5 with OO 3.2.1 and 3.3.0,
the print range is ok. And if I save the file at the above step 6, then 
open it with OO, the print range isn't loaded.

Therefore LO CAN save the print range, however, CAN NOT load it when
reopened. (Overwrite the file at this point will permanently loses it.)

Also, if I set the print range again with LO, it is lost again when
reopened. But then it starts working fine if the link is removed.

Here are the work-arounds I have found so far, but I don't think these
are all that practical.

-Insert a blank sheet at the end of the document. (Hide the blank sheet
 if needed.)
-If a file has a sheet that does not need to be printed, move this sheet
 to the end of the document.
Comment 1 HD 2012-06-13 00:03:37 UTC
Another case to point out.

Use Excel to create an xls file with the same steps as comment 1.
But this time, insert the link to Sheet 2.(Make sure Sheet1 has just some
plain texts w/o any links) And save it while all sheets are set to normal
view, open with LO and save as ods. Reopen the ods and LO does not lose
the print range.

If the xls is saved by using Excel while any of the sheets are in page
preview mode, then the bug is reproduced.

Also, if the link is set to the first sheet of the xls, the bug is reproduced
regardless the view mode.
Comment 2 HD 2012-06-14 18:17:04 UTC
I did some further testing.

The bug wasn't reproducible with versions 3.3.4 and earlier. However, newly
created files with 3.4.0 could reproduce the bug. Therefore, whatever the
change that was made between 3.3.4 and 3.4.0 may be the cause of this bug
and that also means that all versions after 3.4.0 up to the latest version
3.5.4 would be affected.

And files created with 3.3.4 and earlier were not affected even when opened
with 3.4.0 and could also be overwritten w/o losing its print range.
Comment 3 HD 2012-06-14 18:55:13 UTC
One more thing I forgot to mention.

The bug occurs if the print range is defined.

Delete all the defined print range so that all cells with data entered would
automatically be subject of printing, all sheets will keep its print range.

Although I cannot recall at what version of LO starts off with defined range
for the fresh sheet (As for an example, start a new Calc file with 3.5.4 and
go to "Format" -> "Print Range" and you can see that "Delete" can be pressed.
And it means that there is a defined print range even though it is a fresh
sheet) This could also be a part of the cause to this bug, perhaps?
Comment 4 HD 2012-06-14 21:27:33 UTC
Now that I looked into it, new files created with versions 3.3.0 - 3.3.4
do not have a print range defined with fresh sheets. It looks like this
predefined print range feature was first introduced with version 3.4.0.

If I define a print range to a sheet with links using 3.3.4, then it is
lost when opened with 3.4.0 and later versions. It worked fine when print
ranges were defined to all sheets except for the sheet with links.
Comment 5 mlp 2013-01-10 13:28:09 UTC
So it's been out there for six months now, has it not? Yes indeed this beetle is -quite- annoying. Running Libre Office 3.6.4.3  on an XP pro. Pentium 4 and the pest is still there...

Thanks a lot to HD for the detailed reporting which provides with a temporary fix or so it seems: just add an empty sheet at the end of your project and the infectious insect loses all power to irritate.
Comment 6 stuttgarter 2013-04-22 12:36:27 UTC
The bug also exists on ubuntu 12.04 and libreOffice 3.5.7.2
Comment 7 Dave 2014-06-12 08:26:45 UTC
This bug still exists in 4.2.4. 

Thanks to those who pointed out that it only applies to the last sheet, and therefore there is a workaround.
Comment 8 QA Administrators 2016-01-17 20:04:58 UTC Comment hidden (obsolete)
Comment 9 Frédéric Lespez 2016-03-12 15:24:32 UTC
This bug still exist in LibreOffice 5.0.5 and it still only applies to the last sheet.
Comment 10 QA Administrators 2018-06-28 02:47:44 UTC Comment hidden (obsolete)
Comment 11 Frédéric Lespez 2018-06-28 15:51:38 UTC
This bug is still present in Libreoffice 6.0.5.2 under Debian.
Comment 12 Goli4thus 2020-03-09 20:53:19 UTC
This bug still exists in LibreOffice 6.4.1 on Manjaro linux.

The workaround really seems to be to append an empty sheet at last position.
Comment 13 Commit Notification 2021-01-21 07:20:29 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "master":

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

tdf#51022 sc import: fix lost print ranges of last sheet

It will be available in 7.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 14 Commit Notification 2021-01-21 15:38:23 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/88476a6f89f2908fc8083dbbb53391b75192c783

tdf#51022 sc import: fix lost print ranges of last sheet

It will be available in 7.1.1.

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 15 Attila Szűcs 2021-01-28 07:51:42 UTC
*** Bug 77021 has been marked as a duplicate of this bug. ***
Comment 16 NISZ LibreOffice Team 2021-02-08 11:37:57 UTC
Verified in
Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 44b914b1e2616ca8f70e896e653a46ca93610234
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded
Comment 17 BogdanB 2021-07-28 05:16:55 UTC
*** Bug 137232 has been marked as a duplicate of this bug. ***
Comment 18 NISZ LibreOffice Team 2021-07-29 14:04:25 UTC
*** Bug 47592 has been marked as a duplicate of this bug. ***
Comment 19 NISZ LibreOffice Team 2021-07-29 14:52:04 UTC
*** Bug 129960 has been marked as a duplicate of this bug. ***