https://bugs.documentfoundation.org/show_bug.cgi?id=174399
Bug ID: 174399
Summary: FILEOPEN DOCX: floating table (w:tblpPr) in footer
enlarges the footer by the table height in
compatibilityMode 15 - body text area too small, extra
pages
Product: LibreOffice
Version: 26.8.1.1 release
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Writer
Assignee: [email protected]
Reporter: [email protected]
Description:
A DOCX footer contains an empty paragraph, a floating table (w:tblpPr
vertAnchor="text" horzAnchor="text" tblpX="0" tblpY="0", about 18 mm high) and
an empty final paragraph. The document declares compatibilityMode 15.
Writer grows the footer by the full table height and moves the table up into
the page body. The body text area shrinks, and real-world documents get an
extra page that holds only the footer. We hit this with letters exported from
Google Docs.
The same file with compatibilityMode 14 lays out correctly.
Steps to Reproduce:
1. Open the attached floating-footer-table.docx in Writer, or convert it with:
soffice --headless --convert-to pdf floating-footer-table.docx
2. Count the body lines ("Body line N") on page 1.
3. Look at the vertical position of the footer table on page 1.
Actual Results:
- Page 1 holds 50 body lines.
- The footer table sits at about 255-273 mm from the top of the page.
- The footer has grown by the table height, so the body area ends about 6 lines
too early.
Expected Results:
- Page 1 holds 56 body lines.
- The table is positioned at its anchor paragraph and pushed up until it ends
at the page edge (about 278-296 mm from the top).
- The table does not add to the footer height, and body text wraps around it.
Reproducible: Always
User Profile Reset: No
Additional Info:
Version: 26.8.1.1 and 26.8.2.2, Debian build inside the gotenberg/gotenberg
8.38.1 and 8.40.0 Docker images, headless PDF export in a fresh container (no
user profile changes). Older versions not tested.
Analysis (core at tag libreoffice-26.8.1.1):
- Import: TablePositionHandler.cxx:74-155 and
DomainMapperTableHandler.cxx:1737-1765 turn the table into a text frame,
anchored at the final footer paragraph, with IsFollowingTextFlow=true
(header/footer) and IsSplitAllowed=true. No wrap mode is set, so the frame
inherits PARALLEL from the "Frame" style
(DocumentStylePoolManager.cxx:1677-1680).
- Growth: SwHeadFootFrame::FormatSize (hffrm.cxx:290-301) counts only the
paragraphs. Footer text normally ignores frames (txtfly.cxx:931), but the
exception for Word framePr frames (#108724, txtfly.cxx:927-953) matches this
frame: it is anchored at its own paragraph, wraps PARALLEL and has text
content. The anchor
paragraph gets a line as high as the frame (2207 twips in the layout dump),
and the footer grows by that amount.
- compatibilityMode: the exception applies only for compatibilityMode >= 15
(txtfly.cxx:890-895, via TabOverMargin). Setting TabOverMargin=true alone
(tested via FODT) gives the expected layout.
- Second effect: after growing, the footer never shrinks back completely,
because FormatSize raises the minimum height while growing and only halves back
towards it while shrinking (hffrm.cxx:312-322). The footer stays taller than
its content (61.3 mm for 58.7 mm), w:pgMar w:footer has no effect, and results
jump
non-monotonically with tblpY.
Suggested fix: exclude split-allowed fly frames, i.e. floating tables
(IsFlySplitAllowed()), from the framePr exception in txtfly.cxx. The shrink
behaviour in hffrm.cxx is a separate issue that only shows because the anchor
paragraph is pushed down.
Possibly related: tdf#116989, tdf#122878
--
You are receiving this mail because:
You are the assignee for the bug.