Created attachment 180378 [details]
Example file from Word 2016
Attached document was made by Word 2016 from its default document template named "Crisp and clean resume".
This has a first page header in Word, but this is not imported in Writer.
1, Open attached document in Writer
2, Go to Format - Page Style - Header
Notice that header if turned off.
Version: 188.8.131.52.alpha1+ (x64) / LibreOffice Community
Build ID: b6266207b55a7633dc82b02142215757512adfb7
CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Started in 7.0, in 6.4 the header was imported.
Bibisected with win-7.0 to:
author Miklos Vajna <firstname.lastname@example.org> Mon May 11 21:08:35 2020 +0200
committer Miklos Vajna <email@example.com> Tue May 12 09:02:43 2020 +0200
tdf#127778 DOCX import: fix unexpected heading on non-first page ...
Adding CC to: Miklos Vajna
Created attachment 180379 [details]
The example file in Word 2016 and Writer master
Thanks for the bisect!
This never really worked without serious side effects, I fear.
First it "worked" but caused bug 127778, which was itself reported as a regression. Now if I revert the above commit, then that re-opens bug 127778, so that's not a solution, either.
It's probably necessary to understand what commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f tried to do (in 2014).
I guess the only choice here is ignore that this kind-of-worked in the past, and just try to fix this a plain bug. And make sure that all of commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f, commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2 and this bug works at the same time.
The reason this didn't work is because it starts with a table, and so the dummy paragraph it starts with is removed - losing the First Page style property
writerfilter/source/dmapper/PropertyMap.cxx:1911 Set PROP_PAGE_DESC_NAME[First Page]
writerfilter/source/dmapper/DomainMapper.cxx:3321: finished CloseSectionGroup. RemoveDummyPara
(In reply to Justin L from comment #4)
> The reason this didn't work is because it starts with a table, and so the
> dummy paragraph it starts with is removed
Actually, this is not true. We have lots of unit tests starting with tables and "First Page". Dummy Paragraph is already accounted for.
The issue appears to be that this is a table-in-table. Although the outermost table does seem to have the page-desc-name assigned to it, it isn't accepted by LO. So is this a table-handling bug or an import bug?
How to check?
Delete the table on the right-hand column. Now you can see the containing table, and check its properties. You will see the page-break-with-style defined.
Now insert a row above. Check the properties again. When you hit enter, "First Page" will become the page style and the header will appear. Delete the new row, check again, and then the Default Page style will come back without the header.
Some ooxmlexport unit tests related to this bug:
-tdf77796.docx: specifies page 1, Default Page Style written to table
-floating-tables-anchor.docx: has initial table, but anchored.
This fix attempt fails floating-tables-anchor.docx, so I will probably abandon it: http://gerrit.libreoffice.org/c/core/+/139620
Justin Luth committed a patch related to this issue.
It has been pushed to "master":
tdf#149292 docx: pre-emptive unit test
It will be available in 7.5.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:
Affected users are encouraged to test the fix and report feedback.