Bug 34502 - MAILMERGE PRINTING: Field "Page Number" shows constant number instead of page count (Steps in Comment 9)
Summary: MAILMERGE PRINTING: Field "Page Number" shows constant number instead of page...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
Reported: 2011-02-20 09:33 UTC by Emanuele Forner
Modified: 2017-07-14 14:12 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:

Sample Writer file (from the template mentioned in the description) (41.83 KB, application/vnd.oasis.opendocument.text)
2011-02-20 09:33 UTC, Emanuele Forner
Source data for the mail merge field (9.25 KB, application/vnd.oasis.opendocument.spreadsheet)
2011-02-21 00:56 UTC, Emanuele Forner

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Forner 2011-02-20 09:33:54 UTC
Created attachment 43575 [details]
Sample Writer file (from the template mentioned in the description)

I set up a Writer document template which includes page numbering fields (both page number e total pages number), to show in each page the number of the current page and the total number of pages in the document (e.g.: “page 1 of 12”); no problem occurs when I print the document as a single print (or multiple copies of the same print).
But I need to do a mail merge printing, because I want that every single print got a different “stamp” on the first page of the printed document (e.g.: “Original”, “Copy”, etc.).
So, when I do the mail merge printing, it happens that the page number in every page is the same of the total number of pages in the document (e.g.: “page 12 of 12” shows in each page, instead of “page 1 of 12”, “page 2 of 12”, etc.).
The issue occurs both with the Windows and the Linux (Debian) builds of LibreOffice 3.3 (italian localization).
Besides, I had another problem with the “Create single print jobs” command.
The document I wanted to print has 18 pages; printing with the brochure (dépliant) option should take 5 A3 sheets (every sheet has 4 pages, with two halves of the first sheet left blank) for each single copy printed; so, I checked the “Create single print jobs” option, but in the mail merge printing the two blank pages at the end of each single copy printed (the two halves of the first sheet of the brochure) do not come out, instead all the single print jobs are printed continously.
The issue occurs in OpenOffice.org 3.3 too (both the Windows and the Linux/Debian builds, italian localization).
Comment 1 Alex Thurgood 2011-02-20 11:06:59 UTC
The problem with your report is that you list at least potentially two different problems :

1) page numbering incorrect when printing multiple pages from mailmerge

2) Brochure printing problem (which has been reported on other user lists)

and possibly a third :

3) Create single print job on mailmerge

Try looking to see if these have not already been reported as bugs in the bug tracker. If not separate out your problems into individual bug reports.

Comment 2 Emanuele Forner 2011-02-20 13:14:31 UTC
@ Alex Thurgood
I beg your pardon if I seem to have created some kind of mess, putting things together, but the problem(s) I reported had occurred in that specific combination.
I searched for other similar bugs but didn't find anything.
J just have to add one thing: please notice that, in the sample file I attached, page numbering is peculiar, because I put the page numbers neither in the header nor in the footer, but on the outer side of each page, in the middle of it, using a frame (when I put the page numbering in the header, the issue didn't occur again).
But everything comes out when doing mail merge printing of brochures (actually, they are judicial acts printed with a network printer/copier which festures A3 and double-side handling).
("Mail merge" may sound misleading: actually, I use that function to get several copies of the same act, each one having a specific stamp in the first page: "Original", "Copy for the Judge", "Copy for the counterpart", etc. - I am an italian lawyer).
When doing all together (mail merge printing in brochure mode of documents which have an even number of pages - but not multiple of 4), I get what I reported.
So, I don't think that splitting the bug would be really useful...
Comment 3 Alex Thurgood 2011-02-20 14:16:52 UTC
@Emanuele :

As it happens, I am a French lawyer (IP, rather than general) so perhaps we can try and work this thing out together :-)

1) From what you describe, it does not sound like you a really doing a mailmerge, unless the field referenced "Timbri.Civile.Timbro" is the field you are referring to from which you take the expressions "Original", "Copy for the Judge", "Copy for the counterpart" ? Please explain so that I might understand better.

As you did not provide the data source that goes with the document, it will be difficult for us to exactly reproduce the conditions in which you encounter the bug, unless I can just replace your data source with say, a field from the built-in bibliography database.

The other fields in your document appear to be either text placeholders or list of value fields.

2) Do page numbers within a text frame print correctly in a multipage blank document ?

3) The Brochure printing problem has been seen elsewhere (and maybe not yet reported); if I get time tomorrow I will try and look up the bugs referenced in relation to that or scan through the user lists I'm subscribed to.

Comment 4 Emanuele Forner 2011-02-21 00:56:28 UTC
Created attachment 43588 [details]
Source data for the mail merge field
Comment 5 Emanuele Forner 2011-02-21 01:02:01 UTC
@ Alex
"First of all, let's kill all the lawyers!" (Shakespeare) ;-)
1) I have attached the data source for the "mail merge" printing: it's a simple Calc file (I hope that a French lawyer do the same things as an Italian lawyer, when writing for a judgement, so you can easily understand what I am aiming to).
2) The page numbers in the text frame are correctly printed (and in brochure mode, too) when not doing a mail merge printing.
Comment 6 Björn Michaelsen 2011-12-23 11:47:09 UTC Comment hidden (obsolete)
Comment 7 sasha.libreoffice 2012-02-24 23:29:43 UTC
Problem with page number still exist in 3.5.0 (others not tested)
Comment 8 Rainer Bielefeld Retired 2012-03-28 03:56:16 UTC
To be honest: I have no idea what problem you are talking about.

I limit this report to the page number problem.

@Emanuele Forner:
For "Besides, I had another problem" please submit a new report. Before you do please read  hints on <http://wiki.documentfoundation.org/BugReport>!

It seems you understood the problem, can you please explain
- what EXACTLY is unexpected
- and WHY do you believe it's unexpected 
- and what steps exactly are required to reproduce the problem
Comment 9 sasha.libreoffice 2012-03-28 05:19:02 UTC
Steps to reproduce:
0. Open file Sample-file.odt from attachment, other file just download
1. Tools->Mailmerge wizard
2. Next until Step 3 of Wizard.
3. Select address list-> choose file Timbri Copie -> choose first table
4. Next until Step 8 of Wizard.
5. choose "Save merged document", press "Save documents"
6. Open resulting document
Expected: number of page contains number of page
Actually: number of page always 4 (we see 4/5 on each page except of first)
(number of pages placed on left/right side of initial document)

Why expected: I think that number of pages should work as in initial document, difference of initial document should be only in Database fields.
Comment 10 Rainer Bielefeld Retired 2012-03-28 09:08:08 UTC
[Reproducible] with "LibreOffice German UI/Locale [Build-ID: dc9775d-05ecbee-0851ad3-1586698-727bf66] on German WIN7 Home Premium (64bit) 

I additionally checked with a 5 pages document filed "Page Number" and "Page Count" (total number of pages) on each page, printed with reeporter's address database. First page of all correctly show Page 1 of 5, all further pages in all documents show Page 5 of 5 Pages on all pages.

Same with OOo 3.1.1., so that problem seems inherited from OOo.

Reporter also submitted AOOo "Bug#116780 - Mail merge printing problems in OpenOffice.org 3.3 (Writer)"

Still a Problem with Master "LOdev 3.6.0alpha0+  English UI/Locale [Build ID: 9518535-d09cf17-8a74106-c695ecd-16afab (libreoffice-3-5-branch-point)]"  {Win-x86@9-Voreppe Win32 pull time 2012-02-29 04:21:51}. OS: German WIN7 Home Premium (64bit)  

Please set Status to ASSIGNED and add yourself to "Assigned To" if you accept this Bug
Comment 11 Rainer Bielefeld Retired 2012-03-28 09:12:29 UTC
Same when printing via menu "File -> Print" as mail merge letter.

thank you for explication.
Comment 12 ralf 2013-11-15 18:12:42 UTC

I observed the same, today. The reason is that each footer area gets its own individual formatting template, like "Footer 93"., possibly pages are regarded as section, subsequently, and page numbering starts all over.

Work around should be to create the individual multi-page document first before you add footer section. However, in my case, the resulting document included individual (empty) footer areas, and I didn't find out how to replace them with one globally defined footer/page number :(

Another workaround is to add a field "index" to your address table, filling it with line numbers. Use this instead of built-in page numbering to display page numbers.

There is another hint that LibreOffice gets confused with page numbers: The button line of Writer displays (page 1 of 200) if you create an individual mailmerge document of 100 records (and acutally there are just 100 pages), so maybe the footer areas are counted as pages for themselves (twice the amount)?

Please excuse my English, as I am not a native speaker.

Comment 13 sasha.libreoffice 2013-11-16 07:57:57 UTC
Thanks for additional testing and for explanation of workaround

Sorry, but "Version" is version of LO where bug first time appears. Not a current version of LO. If bug disappears we just closing it.
Changing back to "inherited from OOo"
Comment 14 Björn Michaelsen 2014-03-15 16:39:46 UTC
"Inherited from OOo" => thus not a regression
Comment 15 Alex Thurgood 2015-01-03 17:39:32 UTC Comment hidden (no-value)
Comment 16 QA Administrators 2016-01-17 20:05:08 UTC Comment hidden (obsolete)
Comment 17 Timur 2017-07-14 14:12:41 UTC
Looks like nobody "has time" as requested in the previous message that was supposed to be read "in its entirety". Hopefully law business goes well :)

Tested with 5.1.6 and 6.0+. Page numbers are normal, 2/5, 3/5... WFM.