Download it now!
Bug 127409 - Mail merge prints wrong pages when option to print blank pages is only set in doc
Summary: Mail merge prints wrong pages when option to print blank pages is only set in...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.1 rc
Hardware: All Linux (All)
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:6.4.0 target:6.3.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
 
Reported: 2019-09-06 13:16 UTC by Michael Weghorn
Modified: 2019-09-17 10:00 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample doc for mail merge (9.71 KB, application/vnd.oasis.opendocument.text)
2019-09-06 13:16 UTC, Michael Weghorn
Details
Sample data records for mail merge (8.80 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-09-06 13:17 UTC, Michael Weghorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2019-09-06 13:16:57 UTC
Created attachment 153988 [details]
Sample doc for mail merge

On current master, the printout generated by mail merge is incorrect if the global option to print blank pages is disabled, but the document-specific option is enabled.

Sample steps to reproduce:

0) delete existing user profile (e.g.'instdir/user' for dev build)
1) start Writer
2) make sure the following options are set like this in "Tools" -> "Options":
  * "Load/Save" -> "General" -> "Load user-specific settings with the document" is enabled (default)
  * "Load/Save" -> "General" -> "Load printer settings with the document" is enabled (default)
3) disable option "LibreOfficeDev Writer" -> "Print" -> "Print automatically inserted pages"
4) open attached document "test_mailmerge.odt" (which has "PrintEmptyPages" set to "true" in settings.xml)
5) run mail merge wizard and set "2.ods" as data source to use (it has 2 records)
6) save the document (required due to another bug that I'll report separately)
7) select "Print merged documents" from the mailmerge toolbar
8) select to print all pages
9) check printout

Results:

* The printout contains two pages.
  * The first page contains the printout for the first data record (a page with the word "Hello" on it)
  * The second page is blank

Expected results:

* The printout should contain the following pages since the "PrintEmptyPages" option in the document's settings.xml is set to 'true' and document and printer settings should be taken from the document; therefore:
  * page 1 should contain the printout for the first record (i.e. the word "Hello")
  * page 2 should be blank
  * page 3 should contain the printout for the first record (i.e. the word "Hello")

Version: 6.4.0.0.alpha0+
Build ID: 111cf7ee0b26a831577c7c03089f9de159aef16d
CPU threads: 4; OS: Linux 5.2; UI render: default; VCL: kf5; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-US
Calc: threaded
Comment 1 Michael Weghorn 2019-09-06 13:17:24 UTC
Created attachment 153989 [details]
Sample data records for mail merge
Comment 2 Michael Weghorn 2019-09-06 13:19:22 UTC
Bibisecting with "bibisect-linux-64-6.2" shows this is a regression from the following commit:

    commit cc46e7b9c75ddbcaaefde5f396ba76b0b866fa58
    Author: Mike Kaganski <mike.kaganski@collabora.com>
    Date:   Wed Jun 13 15:53:49 2018 +0200

        tdf#116537: use page #s excluding empty pages when they are ignored
        
        Since commit 3c1a343f6936f1dcefdf79a677f8c26ce29676e6,
        SwDoc::CalculatePagesForPrinting expects that PageRange contains
        page numbers that don't include empty pages' numbers, when the
        org.openoffice.Office.Writer/Print/EmptyPages is false.
        
        Change-Id: I4057d6e36765707affbd5f3a4507ae03f4a27171
        Reviewed-on: https://gerrit.libreoffice.org/55756
        Tested-by: Jenkins <ci@libreoffice.org>
        Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>

I'm planning to submit a fix sometime soon.
Comment 3 Michael Weghorn 2019-09-06 13:29:45 UTC
(In reply to Michael Weghorn from comment #0)
> 6) save the document (required due to another bug that I'll report
> separately)

This other bug is bug 127410.
Comment 4 Commit Notification 2019-09-08 07:18:31 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/7d7f024f23024374219a9485a9e1893a221a30fa%5E%21

tdf#127409 Use document-specific value for "Print empty pages"

It will be available in 6.4.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 5 Michael Weghorn 2019-09-08 07:21:40 UTC
Fixed on master.
Pending backport for 6.3: https://gerrit.libreoffice.org/#/c/78757/
Comment 6 Xisco Faulí 2019-09-17 09:44:03 UTC
Verified in

Version: 6.4.0.0.alpha0+
Build ID: c56bf1479cc71d1a2b0639f6383e90c1f7e3655b
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

@Michael Weghorn, thanks for fixing this issue!
Comment 7 Commit Notification 2019-09-17 10:00:47 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/769d33900a51d5ea253885014f367bac6e8077f3%5E%21

tdf#127409 Use document-specific value for "Print empty pages"

It will be available in 6.3.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.