Description: We are developing web editor of docx documents. And to convert html code generated by user to docx/pdf document we use CLI of libreoffice. We have noticed a strange behavior in how libbreoffice counts number of pages in the document. If numeration of pages starts from EVEN number - then it wrong calculates count of pages, adding extra 1. For example if document consists of 2 real pages, and starting page number is 2 - page counter(field NUMPAGES) shows '3'; Starting of numeration was set but manually changing attribute 'w:start' of tag <w:pgNumType> '<w:pgNumType w:fmt="decimal" w:start="2"/>' for page section. We use only one section for entire document. Same issue happens when we are trying to convert docx document to pdf document using console libreoffice. Resulted pdf document also shows wrong count of pages - same as it was in source docx-document. So issue happened only when we set start of page numbering from EVEN page number, for odd page number everything is going well. GUI mode of libbreoffice also shows wrong number of pages in the document. MS Word displays it correctly. So my question is if there is some approach to fix this behavior by amending internal xml code. Thanks in advance. Attaching examples of docx documents with ODD and EVEN starting page number. Steps to Reproduce: 1. Create new docx document in libreoffice of 2 pages. 2. Insert field 'Page Number'. 3. Insert filed 'Page Count'. 4. Unzip created docx file. 5. Within the file 'word/document.xml' add attribute 'w:start' to tag '<w:pgNumType>' with any EVEN value: 2,4,6 etc. Resulted tag should be <w:pgNumType w:fmt="decimal" w:start="2"/>. 6. Zip all files again to docx file. 7. Open resulted file from step 6 in LibreOffice. 8. Export resulted file as PDF document. Actual Results: Page count field displays figure '3' in both docx and pdf files. Expected Results: Page count field displays figure '2' in both docx and pdf files, since it's real number of pages in documents. Reproducible: Always User Profile Reset: No Additional Info: Version: 6.0.6.2 Build ID: 0c292870b25a325b5ed35f6b45599d2ea4458e77 CPU threads: 4; OS: Mac OS X 10.14.5; UI render: default; Locale: ru-RU (ru_RU.UTF-8); Calc: group
Created attachment 151904 [details] Example of WRONG page counting, when page numbering starts from EVEN number
Created attachment 151905 [details] Example of PDF document with WRONG page counting, when page numbering starts from EVEN number
Created attachment 151906 [details] Example of CORRECT page counting in docx document, if page numbering starts from ODD number
Created attachment 156492 [details] comparison MSO 2010 and LibreOffice 6.5 Master
Reproduced in Version: 6.5.0.0.alpha0+ Build ID: b9d6ea1dd7541c4bd866571f9e3f0aa894687c07 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
Regression introduced by: https://cgit.freedesktop.org/libreoffice/core/commit/?id=14bb680949b47332d2921cc68f75340b31ad5c32 author Luke Deller <luke@deller.id.au> 2017-07-12 20:39:50 +1000 committer Miklos Vajna <vmiklos@collabora.co.uk> 2017-09-01 10:45:43 +0200 commit 14bb680949b47332d2921cc68f75340b31ad5c32 (patch) tree 66fe5b9a055956a2affe8b2a12561fcf7fbc00ab parent feb463e93f8c7beb0f6abb52812ac05c4f7724c2 (diff) Insert blank page when first page number is even Bisected with: bibisect-linux64-6.0 Adding Cc: to Luke Deller
Michael Stahl committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/509a02aa96f6d7620cb0bf06c20b3bfa0641be92 tdf#125682 sw: don't insert empty page before first page with even number It will be available in 7.0.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.
should be fixed on master
Verified in Version: 7.0.0.0.alpha0+ Build ID: f32a59a52e3ee2a0a8df9bb76bc1ff0ada7c7f1d CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; Locale: en-US (en_US.UTF-8); UI-Language: en-US Calc: threaded @Michael, thanks for fixing this issue!
Michael Stahl committed a patch related to this issue. It has been pushed to "libreoffice-6-4": https://git.libreoffice.org/core/commit/2e909f572229c16ae86a17d5a6fc83b67e818f9b tdf#125682 sw: don't insert empty page before first page with even number It will be available in 6.4.2. 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.
Michael Stahl committed a patch related to this issue. It has been pushed to "libreoffice-6-3": https://git.libreoffice.org/core/commit/da4f9ff1cfeeeb4f04bb943e94db86887b5c9f58 tdf#125682 sw: don't insert empty page before first page with even number It will be available in 6.3.6. 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.