Bug 149292 - FILEOPEN DOCX First page style not applied to table-in-table
Summary: FILEOPEN DOCX First page style not applied to table-in-table
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: low normal
Assignee: Not Assigned
Keywords: bibisected, bisected, implementationError
Depends on:
Blocks: DOCX-Header-Footer
  Show dependency treegraph
Reported: 2022-05-25 16:31 UTC by Gabor Kelemen (allotropia)
Modified: 2024-06-02 04:26 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:

Example file from Word 2016 (88.19 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-05-25 16:31 UTC, Gabor Kelemen (allotropia)
The example file in Word 2016 and Writer master (125.77 KB, image/png)
2022-05-25 16:32 UTC, Gabor Kelemen (allotropia)

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-05-25 16:31:31 UTC
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: (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
Calc: threaded

Started in 7.0, in 6.4 the header was imported.

Bibisected with win-7.0 to:


author	Miklos Vajna <vmiklos@collabora.com>	Mon May 11 21:08:35 2020 +0200
committer	Miklos Vajna <vmiklos@collabora.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
Comment 1 Gabor Kelemen (allotropia) 2022-05-25 16:32:02 UTC
Created attachment 180379 [details]
The example file in Word 2016 and Writer master
Comment 2 Miklos Vajna 2022-05-26 07:16:44 UTC
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.
Comment 3 Justin L 2022-09-06 01:26:47 UTC
repro 7.5+
Comment 4 Justin L 2022-09-07 16:17:12 UTC Comment hidden (obsolete)
Comment 5 Justin L 2022-09-07 23:26:09 UTC
(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.
Comment 6 Justin L 2022-09-08 01:36:21 UTC
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
Comment 7 Commit Notification 2022-09-08 02:24:50 UTC
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.
Comment 8 Justin L 2023-05-16 01:27:35 UTC
repro 7.6+
Comment 9 Justin L 2024-04-20 19:10:24 UTC
This works in 24.2.

The problem was avoided because now we no longer assign a First Page style, but instead just set a different first header for DOCX.

commit 4b0fa253a4540f5461397815d290586f9ddabe61
Author: Tomaž Vajngerl on Tue Nov 28 13:46:21 2023 +0900
    tdf#136472 adjust ooxml import to handle first header/footer