Created attachment 142657 [details] Sample fle with hidden sections and a text box anchored to the page Using mail merge on a document that contains objects anchored to the page and sections that are hidden for some of the recipients may result in the objects being anchored to the wrong pages in the resulting merged document. Steps to reproduce: 1) open attached document "sample_mail_merge_with_hidden_section.odt" 2) run the Mail Merge wizard: * select "Tools" -> "Mail Merge Wizard" * select "Use the current document" -> "Next" * keep "Letter" for the type of document to create -> "Next" * select data source: * choose "Select Address List" * select "Add" and select the attached file "4-recipients.ods" * click "OK" to confirm to use this as the address list * make sure "This document shall contain an address block" is unselected -> "Next" * make sure "This document should contain a salutation" is unselected -> "Finish" 3) select "Save Merged Documents" in the mail merge toolbar 4) select to save as a single large document and click "Save Documents" 5) Once the document has been generated, choose a file name of your choice to save the generated document to. 6) Open the generated odt file Result: * The generated document has 13 pages (only 10 pages are actually "visible", the other 3 pages were inserted to make sure the content for each of the 4 data records starts on an odd page number). * The content for the single data records starts on pages 1, 3, 5, and 9. (This is expected.) * The text boxes are anchored to pages 1, 5, 9, and 13, which means this does not match the pages on which the content for the single data records starts. * The 4 last pages are empty except for the last text box that is anchored to page 13. Expected result: * The document should contain 9 pages. The 4 last pages from the actual result should not be there at all. * The content for the single data records starts on pages 1, 3, 5, and 9. (This is already the case.) * The text boxes should be anchored to pages 1, 3, 5, and 9 (one text box at the start of the content for each of the 4 data records).
Created attachment 142658 [details] Sample recipient data for the mail merge
The cause of the problem is that the amount of pages in the merged document differs for the single data records, as there is a text section that is hidden when the value in the column "Hidden" in the recipient data is "True". There is just a single page of content if the section is hidden, while there is three pages of content when the section is not hidden. I have analyzed the problem and plan to create a change in Gerrit soon.
Gerrit change: https://gerrit.libreoffice.org/55636 Feedback is highly welcome, since most of this is quite new to me...
(In reply to Michael Weghorn from comment #3) > Gerrit change: https://gerrit.libreoffice.org/55636 > > Feedback is highly welcome, since most of this is quite new to me... Thanks for the patch. Setting to ASSIGNED then. Review will take place in gerrit.
Michael Weghorn committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=89f896d2cfd84b711583f98a6343e9835a9aed11 tdf#118113 MM: Make sure page count is up to date It will be available in 6.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Michael Weghorn committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=ab665e1c939ec231338f9eac256d37cb1c5afcc9 tdf#118113 Add unit test It will be available in 6.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Michael Weghorn committed a patch related to this issue. It has been pushed to "libreoffice-6-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=e8a46b0171a49e6b49a2e7b89c8bdfef84ef41ef&h=libreoffice-6-1 tdf#118113 MM: Make sure page count is up to date It will be available in 6.1.0.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.