Bug 45447 - Writer ODF export: text:anchor-page-number="0"
Summary: Writer ODF export: text:anchor-page-number="0"
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Master old -3.6
Hardware: All All
: medium normal
Assignee: Not Assigned
Whiteboard: odf
Depends on:
Reported: 2012-01-31 07:14 UTC by sasha.libreoffice
Modified: 2013-11-18 11:46 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

validated file (14.78 KB, application/vnd.oasis.opendocument.text)
2012-01-31 07:14 UTC, sasha.libreoffice
source document (12.00 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2012-02-01 21:39 UTC, sasha.libreoffice
Example document that when saved as ODT will generate invalid page number (45.57 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2012-04-24 19:55 UTC, Matthew Holloway

Note You need to log in before you can comment on or make changes to this bug.
Description sasha.libreoffice 2012-01-31 07:14:59 UTC
Created attachment 56393 [details]
validated file

file not passed validation on http://odf-validator.rhcloud.com/
error is:
odt/content.xml[2,16296]: Error: attribute "text:anchor-page-number" has a bad value: "0" does not satisfy the "positiveInteger" type

LibO 3.6.0 master a1275f8-9eed775-f061262
Comment 1 Michael Stahl (CIB) 2012-02-01 14:11:27 UTC
so a 0 page number is clearly invalid, but i can't reproduce
this problem here.

loaded the document in LO 3.4.3, 3.5rc3, master,
it looks rather broken, but save it again and i get this:


is this document imported from some Word format or something?
there's some weird stuff in meta.xml (but generator is LibreOffice).

resolving WORKSFORME for now, if you have a reproducible way to
get an invalid document please reopen.
Comment 2 sasha.libreoffice 2012-02-01 21:39:36 UTC
Created attachment 56497 [details]
source document

to reproduce this problem, open attached docx and immediately save as odt.
If do any change, this becomes not reproducible
Comment 3 Michael Stahl (CIB) 2012-02-02 07:54:22 UTC
can reproduce it: after importing the docx bugdoc,
the frame is indeed anchored on page 0.

so i don't think it's a good idea to fix the ODF export for this,
because writing an anchor type "page" without an
anchor-page-number attribute doesn't sound like a good idea;
have added an assertion on master for this.

looks like something is going wrong in the docx import;
i've noticed that there's some code in SwCntntNotify::~SwCntntNotify
that wants to fix frame anchors, perhaps that has
something to do with this...

perhaps those who know the writerfilter stuff better can investigate?
Comment 4 Matthew Holloway 2012-04-24 19:55:52 UTC
Created attachment 60550 [details]
Example document that when saved as ODT will generate invalid page number

Here's another document demonstrating the issue.

Open and then save as ODF to generate an invalid ODT file with a frame anchored to page number 0.

Here's a copy of the source of the resulting ODT...

Comment 5 Julien Nabet 2013-11-17 10:38:59 UTC
On pc Debian x86-64 with master sources updated yesterday, I don't reproduce this problem but had others like these:
Chem 161L Fall2011 Sched1_master.odt/styles.xml[2,7392]: Error: unexpected attribute "style:contextual-spacing"
Chem 161L Fall2011 Sched1_master.odt/styles.xml[2,17169]: Error: unexpected attribute "style:layout-grid-snap-to-characters"

Should we close this one and open new ones or should we rename this one, other?
Comment 6 Julien Nabet 2013-11-17 10:48:18 UTC
About my last comment, I found 2 bugtrackers put in "See also" + https://wiki.documentfoundation.org/Development/ODF_Implementer_Notes#LibreOffice_ODF_extensions

BTW, when saving with 4.1 sources, I didn't have "layout-grid-snap-to-characters" error
Comment 7 sasha.libreoffice 2013-11-18 05:27:40 UTC
I have changed title to actually reproducible bug.
I am not sure if to close this bug or not.

@  Michael Stahl
What do You think about this bug?
Comment 8 Michael Stahl (CIB) 2013-11-18 11:46:48 UTC
well thanks for hijacking this bug for a totally different one.

please file *one* bug per attribute or element that the validator complains about.

closing this bug per comment #5.