Bug 119232 - FILEOPEN: Left page header and right page header reversed for specific .DOC that has 1st page even and 2nd odd
Summary: FILEOPEN: Left page header and right page header reversed for specific .DOC t...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Justin L
URL:
Whiteboard: target:6.2.0
Keywords: needsDevAdvice
Depends on:
Blocks:
 
Reported: 2018-08-12 19:02 UTC by Tom Williams
Modified: 2019-09-24 20:26 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
.DOC with page header issue (47.50 KB, application/msword)
2018-08-12 19:02 UTC, Tom Williams
Details
.DOC with page numbers (35.00 KB, application/vnd.ms-word)
2018-08-16 10:09 UTC, Timur
Details
.DOCX with page numbers (18.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-08-16 10:11 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Williams 2018-08-12 19:02:18 UTC
Created attachment 144127 [details]
.DOC with page header issue

When opening a 2-page Word document with a right page header, the right page header and left page header are reversed.  So, the right page header appears on the left page and the left page header appears on the right page.

The right page header contains a page number where the left page header is blank.  As a result, the first page of the document shows the page number where the second page does not show a page number.

This doesn't happen when viewing the document in MS Word.  In MS Word, the page number appears in the header of the second page, which I believe to be the right-side page.

The document is a resume so the page number should appear only on the right-side page.
Comment 1 Tom Williams 2018-08-12 19:03:48 UTC
I forgot to mention this behavior occurs in Writer 4.4.6.3 on Ubuntu Linux, Writer 5.1.6.2 on Linux Mint, and Writer 6.0.6.2 on Windows 7 and Windows 10.
Comment 2 Dieter 2018-08-14 08:58:17 UTC
I can't see what's wrong with the document. Page layout is right - left. so the first page is the right page with the right header and the second page is the left page with left header.

I'm not familiar with MS-Word, so I don't know if there is for example a page layout left-right, that can't be imported in LO.
Comment 3 Tom Williams 2018-08-14 14:10:36 UTC
Thanks.  So, when I open the attached document in MS Word, the header *does not* appear on the top of the first page, which has the name and address on the top.  The header appears only on the second page, which continues the resume.  In LibreOffice Writer, the exact opposite happens.

I'm ok with the MS Word being "wrong" in that the right and left pages are reversed, yet Word somehow manages to reverse them.  It's just this will appear as misbehavior in Writer because the page header appears on the "wrong page".

I'll get a screen shot in MS Word to post, when I get a chance.
Comment 4 Timur 2018-08-14 14:21:24 UTC
In Word, if we start with Even header for page 1 and check Diff. Odd&Even, Word will turn page 1 to Odd and set 2 as Even, so it will correctly save.
DOC attachment 144127 [details] seems wrong and it's not clear how it was created.   
I'm not sure if this is NotaBug (LO behaves as it should), WontFix (doesn't read properly this DOC but it's wrong anyway) or New enhancement (LO should read even wrong DOC correctly, similar to Word).
Comment 5 Tom Williams 2018-08-14 14:40:17 UTC
Thanks for the comments.  I actually don't know how the original document was created either.  I was helping a friend with her resume and reduced her original document to the attached test, in MS Word.

If the document is "bad" and Writer is behaving correctly, I'm ok with that and we can close this bug report.

Thanks!
Comment 6 Dieter 2018-08-15 17:16:19 UTC
(In reply to Tom Williams from comment #5)
> If the document is "bad" and Writer is behaving correctly, I'm ok with that
> and we can close this bug report.
> 
> Thanks!

I think, we can close this report as RESOLVED NOTABUG. If anybody diagrees, please reopen it.
Comment 7 Justin L 2018-08-15 18:28:21 UTC
This is one case where LO actually reads a .docx better than a .doc. I seem to remember seeing a patch in docx for this. Note that in Word, the first page is numbered as page2 and the second page is numbered as page3.
Comment 8 Justin L 2018-08-16 06:43:23 UTC
Interesting. DOC format does support import the starting page number, but in this document, it indicates that is starts on page1 and not page2.
warn:JCL:21938:21938:sw/source/filter/ww8/ww8par6.cxx:1012: pgnStart[1]

I guess the fact that the section starts on an even page means that Word automatically changes the starting page number.
Comment 9 Timur 2018-08-16 10:09:41 UTC
Created attachment 144236 [details]
.DOC with page numbers

Here is the same .DOC with more clear headers.
From Justin's comment I conclude we may have bug in reading DOC differently from DOCX.
Comment 10 Timur 2018-08-16 10:11:11 UTC
Created attachment 144237 [details]
.DOCX with page numbers

Same DOCX is read in LO as shown in MSO. Note headers and page numbers.
Comment 11 Justin L 2018-08-16 18:38:12 UTC
proposed fix: https://gerrit.libreoffice.org/59221

DOCX doesn't have this problem at all, and I didn't find any code trying to massage this. In fact, it looks like PROP_PAGE_NUMBER_OFFSET isn't being set at all, so basically that suggests that complete default values are being done "properly" by sw. But the same was true in the ww8 side - SetNumOffset wasn't being called at all in this case, but sw wasn't handling it properly this time.
Comment 12 Commit Notification 2018-08-29 09:21:21 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#119232 ww8import: even page means default to start on page 2

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.