Bug 156839 - Printing from macro creates empty page instead of the second sheet
Summary: Printing from macro creates empty page instead of the second sheet
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
 
Reported: 2023-08-21 12:53 UTC by Gabor Kelemen (allotropia)
Modified: 2024-04-07 03:14 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Example file (33.13 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-08-21 12:53 UTC, Gabor Kelemen (allotropia)
Details
First sheet printed to PDF (12.36 KB, application/pdf)
2023-08-21 12:54 UTC, Gabor Kelemen (allotropia)
Details
Second sheet printed to PDF (2.42 KB, application/pdf)
2023-08-21 12:55 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-08-21 12:53:39 UTC
Created attachment 189070 [details]
Example file

Attached user made file contains two sheets and a macro used to set print properties (print range, print settings) and to print the whole spreadsheet.

When the macro is run, the resulting print contains an empty page in place of the second sheet.

1. Open attached file
2. Press the Print button on the first sheet
-> Second sheet is not printed, only an empty page.
This is "fixed" if the Tools - Options - Calc - Print - Print only selected sheets is disabled.

The problematic behavior seems to happen only with the macro, not from the Print dialog or from the CLI --convert-to pdf call.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e60ef8651cfb30335471d1622e58c13eebc7d58b
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

Seems to have started in 4.4. Before that the first sheet was exported.
Bibisect range from windows-4.4 repo:
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=e1386e32a85eb5c6b4294a8ca3e4461b92707fc3..e62764108a1832e746f68768c29eaa90606903a7

of which, this seems suspicious:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=0b793116deaf35ce67245c1106e5ed5a722c7560

author	David Tardon <dtardon@redhat.com>	2014-06-19 16:57:03 +0200
committer	David Tardon <dtardon@redhat.com>	2014-06-19 17:14:48 +0200
commit 0b793116deaf35ce67245c1106e5ed5a722c7560 (patch)

rhbz#1111216 allow to export an empty sheet to PDF

https://bugzilla.redhat.com/show_bug.cgi?id=1111216
Comment 1 Gabor Kelemen (allotropia) 2023-08-21 12:54:45 UTC
Created attachment 189071 [details]
First sheet printed to PDF

I use the PDF24 virtual printer, and that shows 2 documents that it can save, for the two sheets. This is the first one, looks good.
Comment 2 Gabor Kelemen (allotropia) 2023-08-21 12:55:54 UTC
Created attachment 189072 [details]
Second sheet printed to PDF

The second sheet results in an empty page. Before 4.4 the PDF24 did not show this document at all.
Comment 3 Stéphane Guillou (stragu) 2023-09-08 19:36:52 UTC
Tested with CUPS' print to pdf printer-driver-cups-pdf, set as default printer via File > Printer Settings...; which will output by default in ~/PDF.

Reproduced that I'm getting two separate files without the content's of the second sheet: one page of sheet 1's contents, one empty page.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: beaea2e992912b4747d790070b26371f557b1f57
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

In OOo 3.3, I also get just the first sheet, but no emtpy second document.

So is this really a regression? 0b793116deaf35ce67245c1106e5ed5a722c7560 made it possible to export the second empty sheet, but it must have been considered to be empty before that.

(In reply to Gabor Kelemen (allotropia) from comment #0)
> The problematic behavior seems to happen only with the macro, not from the
> Print dialog or from the CLI --convert-to pdf call.
Alternatively, you can select both sheet tabs with Shift + Click, and both pages will have content. In a way, it's consistent with the setting...

Are macros supposed to ignore in-app active selection? Or should this be fixed by moving the active selection in the macro instead? I guess oSheet.createCursorByRange() is already doing that in the macro...
Comment 4 QA Administrators 2024-03-07 03:15:21 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2024-04-07 03:14:36 UTC
Dear Gabor Kelemen (allotropia),

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp