Bug 77111 - ODF import: page number is 0 (zero) instead of 1 (importing document written by legacy OOo versions < 3.3)
Summary: ODF import: page number is 0 (zero) instead of 1 (importing document written ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: high major
Assignee: Justin L
URL:
Whiteboard: odf target:5.4.0 target:5.3.1 target:...
Keywords: bibisected, bisected, regression
: 76325 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-06 18:30 UTC by Mo
Modified: 2017-07-18 09:50 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments
The main document (69.67 KB, application/vnd.oasis.opendocument.text)
2014-07-15 07:59 UTC, LUCQUIAUD
Details
The wrong page number (LibreOffice) (136.96 KB, image/gif)
2014-07-15 08:00 UTC, LUCQUIAUD
Details
The correct page number (OpenOffice) (25.84 KB, image/gif)
2014-07-15 08:01 UTC, LUCQUIAUD
Details
OpenOffice version (13.14 KB, image/gif)
2014-07-15 08:06 UTC, LUCQUIAUD
Details
LibreOffice version (18.32 KB, image/gif)
2014-07-15 08:07 UTC, LUCQUIAUD
Details
Windows version (28.37 KB, image/gif)
2014-07-15 08:08 UTC, LUCQUIAUD
Details
Compare LO versions (64.62 KB, image/jpeg)
2015-10-22 09:40 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mo 2014-04-06 18:30:47 UTC
In inserting page numbers (in the format Page XX of YY) in the footnote, the first page number is zero instead of one. So for my particular document of seven pages, the first page read Page 0 of 7 and the last page read Page 6 of 7. I've used this format of numbering my pages many times in the past, without these results.

I checked to see whether there were settings that I could change to have the first page revert to 1, but didn't find anything. If this bug is not fixed, I will not be able to number the pages on any document. So I labeled the bug as major.
Comment 1 tommy27 2014-04-06 18:47:10 UTC
please describe issue step by step how do you exactly number the pages or provide a test file. otherwise it will impossible to help

I've also added a summary description which was missing

status --> NEEDINFO
revert it to UNCONFIRMED once you provide missing informations.
Comment 2 LUCQUIAUD 2014-07-15 07:57:56 UTC
Hello, I've the same problem with a document. When this document is opened with OpenOffice 3.2.1, there's no problem.
When this document is opened with LibreOffice, the number of first page is 0.
I've this bug whith LibreOffice 4.2.4.2 and 4.2.5.2.


20140707-100532-lucquiaud-BAS.odt => document
hardCopy 01 - pb LO.gif => wrong page number with LibreOffice
hardCopy 02 - ok OO.gif => correct page number with OpenOffice
Comment 3 LUCQUIAUD 2014-07-15 07:59:44 UTC
Created attachment 102835 [details]
The main document
Comment 4 LUCQUIAUD 2014-07-15 08:00:28 UTC
Created attachment 102836 [details]
The wrong page number (LibreOffice)
Comment 5 LUCQUIAUD 2014-07-15 08:01:00 UTC
Created attachment 102838 [details]
The correct page number (OpenOffice)
Comment 6 LUCQUIAUD 2014-07-15 08:06:46 UTC
Created attachment 102839 [details]
OpenOffice version
Comment 7 LUCQUIAUD 2014-07-15 08:07:33 UTC
Created attachment 102840 [details]
LibreOffice version
Comment 8 LUCQUIAUD 2014-07-15 08:08:42 UTC
Created attachment 102842 [details]
Windows version
Comment 9 LUCQUIAUD 2014-07-15 08:40:57 UTC
Moreover, with LibreOffice, there's a empty page in the document that is not present with OpenOffice (the document is correct with OpenOffice).
Comment 10 LUCQUIAUD 2014-07-15 08:42:26 UTC
Moreover, with LibreOffice, there's a empty page in the document that is not present with OpenOffice (the document is correct with OpenOffice) => See the hard copy "The wrong page number (LibreOffice)"
Comment 11 LUCQUIAUD 2014-07-18 09:47:11 UTC
Hello,
you can put page numbers right as follows :
1) save the document,
2) close the document,
3) when document reopened, page numbers are corrects.

I hope it could help.
Comment 12 tommy27 2014-07-18 11:08:19 UTC
thanks for test files. they helped a lot.

I confirm test document is show with a "0/8" page numbering instead of "1/6" page numbering.

If you resave that document in LibO 4.2.5.2 and reload it the numbering gets corrected to right "1/6" format
Comment 13 tommy27 2014-07-18 11:12:11 UTC
this is a regression of the 4.2.x branch.
LibO 4.1.5.3 loads file with correct "1/6" page number format
Comment 14 Xisco Faulí 2014-07-22 13:39:16 UTC
bibisected:
 1b204196f0fbb248722573341fab666b41038431 is the first bad commit
commit 1b204196f0fbb248722573341fab666b41038431
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Wed Nov 27 06:44:01 2013 +0000

    source-hash-03e9845525037a02dac320ad09fb6eed34e9f0da
    
    commit 03e9845525037a02dac320ad09fb6eed34e9f0da
    Author:     Michael Stahl <mstahl@redhat.com>
    AuthorDate: Tue Oct 22 22:15:42 2013 +0200
    Commit:     Michael Stahl <mstahl@redhat.com>
    CommitDate: Tue Oct 22 22:30:20 2013 +0200
    
        firebird: fix typo in b0f00d38254eca70e196e1580faac4a215bc2b12
    
        Change-Id: I824721abeecfbd6d9592e00f73f6ef4b6e6d54ac

:100644 100644 d550a738c0d57cc8ed1dee181a619abfbf07111f 7f9428c851b64605d78ff041a8ef2390db6ed7d7 M	ccache.log
:100644 100644 361f74b672f3bd6003be764efdaa5768bec059b2 b08ddbbe6b4c1a704226c9591da17245286a6ab0 M	commitmsg
:100644 100644 7e1cf2ef8ef429ecde6c14f0ecc1da01d3d1bb96 f202cdf6fb8d17505a2694eed4867bb6deb9ae9d M	make.log
:040000 040000 e469883d9b322a09099a9f921cf70ea5c58dab95 543ce334ef95614317a778006afc160215a144e3 M	opt

# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# good: [e02439a3d6297a1f5334fa558ddec5ef4212c574] source-hash-6b8393474974d2af7a2cb3c47b3d5c081b550bdb
git bisect good e02439a3d6297a1f5334fa558ddec5ef4212c574
# bad: [4850941efe43ae800be5c76e1102ab80ac2c085d] source-hash-980a6e552502f02f12c15bfb1c9f8e6269499f4b
git bisect bad 4850941efe43ae800be5c76e1102ab80ac2c085d
# skip: [a043626b542eb8314218d7439534dce2fc325304] source-hash-9379a922c07df3cdb7d567cc88dfaaa39ead3681
git bisect skip a043626b542eb8314218d7439534dce2fc325304
# skip: [aba65c3e4c0df07e4909aeefb758cdb688242bf6] source-hash-827524abfb4b577d08276fde40929a9adfb7ff1a
git bisect skip aba65c3e4c0df07e4909aeefb758cdb688242bf6
# skip: [aba65c3e4c0df07e4909aeefb758cdb688242bf6] source-hash-827524abfb4b577d08276fde40929a9adfb7ff1a
git bisect skip aba65c3e4c0df07e4909aeefb758cdb688242bf6
# bad: [c81a8a0dcfc1ed095a80e4485c89dd0fcaf73f31] source-hash-c69ed33628ec0b7abf6296539cf280d6c4265930
git bisect bad c81a8a0dcfc1ed095a80e4485c89dd0fcaf73f31
# bad: [c81a8a0dcfc1ed095a80e4485c89dd0fcaf73f31] source-hash-c69ed33628ec0b7abf6296539cf280d6c4265930
git bisect bad c81a8a0dcfc1ed095a80e4485c89dd0fcaf73f31
# good: [1d4980621741d3050a5fe61b247c157d769988f2] source-hash-89d01a7d8028ddb765e02c116d202a2435894217
git bisect good 1d4980621741d3050a5fe61b247c157d769988f2
# skip: [89110ca258fa7a15dfc546acfb39e76fc3eb2a44] source-hash-e450a2c506ac7cd4433b0f93fc750a89919bc03c
git bisect skip 89110ca258fa7a15dfc546acfb39e76fc3eb2a44
# good: [1cca92a409385d9288c28a54d5e3008e56728bc0] source-hash-7be7824bbbdeee6fa998b950e6046ab37fe690cb
git bisect good 1cca92a409385d9288c28a54d5e3008e56728bc0
# skip: [5fa28ce2931a35ae64ae08d3904cfb76d24459d8] source-hash-2304beaca33c63b94df99cb827716f00ce259f9a
git bisect skip 5fa28ce2931a35ae64ae08d3904cfb76d24459d8
# good: [2a9ff869c5638dc5c3aa387d0fe55c3291c86288] source-hash-01b7e04172889cbc9e4ac404b105e18ddc062d6f
git bisect good 2a9ff869c5638dc5c3aa387d0fe55c3291c86288
# bad: [387dd1052972d27a3065a249b357e50e0a29829b] source-hash-35836f350861b33a0c28307a413eff76d0433d1e
git bisect bad 387dd1052972d27a3065a249b357e50e0a29829b
# good: [5b0bc0b6253d7572470c6a3058d5fff68c93897f] source-hash-bdf2b506c38b38af531d8c8aa14dd51d89386899
git bisect good 5b0bc0b6253d7572470c6a3058d5fff68c93897f
# bad: [288796dca516e779d45513775be7c7bc3ff291f7] source-hash-5d0051efb99c6cbd0dc4dd655a71e7435159f6bc
git bisect bad 288796dca516e779d45513775be7c7bc3ff291f7
# bad: [1b204196f0fbb248722573341fab666b41038431] source-hash-03e9845525037a02dac320ad09fb6eed34e9f0da
git bisect bad 1b204196f0fbb248722573341fab666b41038431
# first bad commit: [1b204196f0fbb248722573341fab666b41038431] source-hash-03e9845525037a02dac320ad09fb6eed34e9f0da
Comment 16 Adam CloudOn 2014-07-24 13:03:49 UTC
(In reply to comment #15)
> Thus
> http://cgit.freedesktop.org/libreoffice/core/log/
> ?qt=range&q=bdf2b506c38b38af531d8c8aa14dd51d89386899..
> 03e9845525037a02dac320ad09fb6eed34e9f0da
> 
> and
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=c2ccd20c0fd92bddfff76447754541705e3eb8f3 looks rather suspicious.
> 
> @Adam: Care to take a look?

@Bjorn : will try to take a look at this next week.
even though - if I create a new document with latest master -
page numbers are correct. So I am assuming it was some bug
that saved the value to the ODF file wrong.
Comment 17 Björn Michaelsen 2014-10-16 14:58:59 UTC Comment hidden (obsolete)
Comment 18 Michael Weghorn 2015-01-10 23:09:54 UTC
I am setting hardware and platform to "All" because bibisecting was carried out before.
Comment 19 OfficeUser 2015-10-20 20:39:43 UTC
Bug 95206 describes a similar issue in Calc.
Comment 20 Timur 2015-10-22 09:40:21 UTC
Created attachment 119875 [details]
Compare LO versions
Comment 21 Oliver Specht (CIB) 2015-11-17 08:30:12 UTC
The problem has been introduced with 
commit c2ccd20c0fd92bddfff76447754541705e3eb8f3
Author: Adam Co <rattles2013@gmail.com>
Date:   Thu Aug 29 17:16:44 2013 +0300
    fdo#44689: fix for specific case of page restart-value 0

With this change it was possible to _have_ a page 0 as new page number. 
Before that the page number 0 meant that page counting should not be restarted at a page break. 

The table dialog page always sends this 0-value if you insert a page break with a change of the page style. 

The similar dialog for paragraphs doesn't do it initially. But if you insert a page breaks with page style and a page no. > 0 and open the dialog again to reset this page number to 0 then you will also get a page no. 0.

To solve this an additional CheckBox is required in both dialog pages so that the user can determine whether or not a page no. 0 is desired.

This will not fix existing documents.
Comment 22 Luke 2015-12-09 22:34:13 UTC
See Bug 90508: The .DOC importer is now ignoring the Different First Page Headers flag.
Comment 23 Robinson Tryon (qubit) 2015-12-10 01:18:32 UTC Comment hidden (obsolete)
Comment 24 Xisco Faulí 2016-09-24 14:51:31 UTC
*** Bug 90508 has been marked as a duplicate of this bug. ***
Comment 25 Justin L 2017-01-18 13:51:46 UTC
It should be safe to fix this one. I was about to mark it as WONTFIX but changed my mind because xmlexpit.cxx has been using XML_AUTO since 2010 (instead of writing a zero) and before that a zero had always been treated as a non-defined page. Apparently Adam's patch really only is intended for compatibility since ODT documents still won't export a page 0.

Since it is impossible to export a zero to xml, it should be impossible to import a zero as well.

Treating as low priority since it should only affect rather old documents and because I have been waffling back and forth about whether to fix it. https://gerrit.libreoffice.org/33267 tdf#77111 odt import: treat PAGEDESC_PAGENUMOFFSET==0 as auto
Comment 26 Commit Notification 2017-02-27 12:03:59 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e36f0860f00af139a8fa94d36302f7b0c56383fe

tdf#77111 odt import: treat PAGEDESC_PAGENUMOFFSET==0 as auto

It will be available in 5.4.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.
Comment 27 Commit Notification 2017-02-27 21:57:03 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1f87318abb50e164aa4125747493c5ee02e8687c&h=libreoffice-5-2

tdf#77111 odt import: treat PAGEDESC_PAGENUMOFFSET==0 as auto

It will be available in 5.2.7.

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.
Comment 28 Commit Notification 2017-02-27 21:57:15 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ae225329435cb49e61e3c9fc76129aa4e334598a&h=libreoffice-5-3

tdf#77111 odt import: treat PAGEDESC_PAGENUMOFFSET==0 as auto

It will be available in 5.3.2.

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.
Comment 29 Commit Notification 2017-02-28 10:06:53 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e7f463cea58fc87e114008a726b4ea7489f36aa9

tdf#77111 sw: add unit test, fix getting PageNumberOffset property

It will be available in 5.4.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.
Comment 30 Michael Stahl (allotropia) 2017-02-28 12:34:30 UTC
this problem only happens if a table has a page-break with page style and automatic page number offset.

OOo originally had a bug that it exported a wrong attribute value "0" instead of "auto" in this case, which was fixed in OOo 3.3 (issue 114163).

then for better DOC support, the 0 was allowed as a valid page number offset (originally OOo required at least 1) - this caused the bug because now the invalid "0" written by old OOo is interpreted as page number offset 0 instead of automatic.

the attachment was written by OOo 3.2 - it is not valid ODF but we still need to import it like older versions did, thanks Justin for the fix.
Comment 31 Adolfo Jayme Barrientos 2017-02-28 18:18:53 UTC
Backport of Justin’s fix to 5.2.6 is here: https://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-5-2-6&id=b59f4307144ed4a7d0a17533fb11f8fd0f195636
Comment 32 Michael Stahl (allotropia) 2017-03-01 11:08:34 UTC
*** Bug 76325 has been marked as a duplicate of this bug. ***
Comment 33 Commit Notification 2017-03-01 11:47:58 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d36fa0589ab822dc617c65b4d0d3bf68c092ad37

tdf#77111 cui,sw: fix page number offset on paragraph dialog "Text Flow"

It will be available in 5.4.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.
Comment 34 Commit Notification 2017-03-01 12:58:27 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-3-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6a170ee831a116b2aeb1506986fca4c672c75368&h=libreoffice-5-3-1

tdf#77111 odt import: treat PAGEDESC_PAGENUMOFFSET==0 as auto

It will be available in 5.3.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.
Comment 35 Commit Notification 2017-03-01 16:31:38 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c1e7fc6f497d7570cb0832c43647d295f8592567

tdf#77111 sw: fix page number offset on table dialog "Text Flow"

It will be available in 5.4.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.
Comment 36 Commit Notification 2017-03-01 16:33:17 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a5104f575a5acf8aea957cb79aa0fd67bc74f141&h=libreoffice-5-3

tdf#77111 cui,sw: fix page number offset on paragraph dialog "Text Flow"

It will be available in 5.3.2.

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.
Comment 37 Commit Notification 2017-03-01 17:00:14 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/help/commit/?id=e7999c35fd7460118469142420c7d39ba5562222

tdf#77111 helpcontent: adapt "Text flow" tab page help
Comment 38 Michael Stahl (allotropia) 2017-03-01 17:04:41 UTC
so there are actually 2 related problems here:

1. Description and comment #21 complains about the misleading UI

2. comment #2 - #11 are about the OOo < 3.3 ODF import problem

i've fixed problem 1 as well now, by adapting the
"Text Flow" tab page in both the paragraph and table dialogs
so that there is a check box next to "page number" that
replaces the previous use of the magic "0" number.
Comment 39 Commit Notification 2017-03-01 20:29:18 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=362ff67556cca0890ca01f2de44596491c0e9bc8&h=libreoffice-5-3

tdf#77111 sw: fix page number offset on table dialog "Text Flow"

It will be available in 5.3.2.

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.
Comment 40 Commit Notification 2017-03-02 13:26:59 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c43cc2d70a8083c70e615335d19780bd59f40fd8&h=libreoffice-5-2

tdf#77111 cui,sw: fix page number offset on paragraph dialog "Text Flow"

It will be available in 5.2.7.

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.
Comment 41 Commit Notification 2017-03-02 13:27:05 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e4f50efd000734c8259ed2915bf0dd1c71700ceb&h=libreoffice-5-2

tdf#77111 sw: fix page number offset on table dialog "Text Flow"

It will be available in 5.2.7.

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.