Estimated read time: 3 minutes
This post is part of a series to describe how Writer now gets a feature to handle tables that are both floating and span over multiple pages.
This work is primarily for Collabora Online, but is useful on the desktop as well. See the 8th post for the previous part.
Motivation¶
Multi-page floating tables always wrapped their anchor text only on the last page, to be compatible with Word's default behavior. There is a special flag in DOCX files to wrap on all pages, though. In this part, you can read about handling of this flag in Writer.
Results so far¶
Regarding testing of the floating table feature in general, the core.git repository has 84 files now which are focusing on correct
handling of floating tables (filenames matching floattable-|floating-table-
). This doesn't count
cases where the document model is built using C++ code in the memory and then we assert the result
of some operation.
Here are some screenshots from the fixes this month:
The first screenshot shows a case where multi-page floating tables are nested. For this document, we not only have an inner and an out table, but we also have a middle one, giving us 3 nesting tables. Some of the inner table frames had a bad position, leading to overlapping text, now fixed.
The next screenshot shows the case where the magic allowTextAfterFloatingTableBreak
flag is set.
We used to wrap content of the anchor only on the last page, unconditionally. Now we either wrap on
the last page (default) or on all pages (when this flag is present).
The last screenshot shows a document full of floating tables. These used to be inline ones, and then they could not overlap by definition, but now extra effort was needed to position them in a way that no overlap happens between the tables. Now our render result matches Word.
How is this implemented?¶
If you would like to know a bit more about how this works, continue reading... :-)
As usual, the high-level problem was addressed by a series of small changes:
- tdf#126449 sw floattable: fix too small height of non-last anchors
- tdf#126449 sw floattable: DOC import: handle inner floating table
- sw floattable, crashtesting: fix PDF export of fdo56210-3.docx
- crashtesting: fix PDF export of fdo45193-1.docx
- tdf#157571 sw floattable: fix incorrect blank space after table-in-shape
- sw floattable, crashtesting: fix PDF export of ooo91654-1.doc
- sw floattable: add an AllowTextAfterFloatingTableBreak compat flag
- sw floattable, wrap on all pages: add layout
- sw floattable, wrap on all pages: add DOCX filter
- tdf#157573 sw floattable: fix incorrect lack of left margin after table
- tdf#157573 sw floattable: add missing testcase
- tdf#157590 sw floattable: avoid hang in the nested + row span case
- sw floattable: remove now unused FloattableNomargins compat flag
- tdf#155040 sw floattable, RTF: fix table is overlapped by subsequent inline one
- tdf#155682 sw floattable: fix DOCX with big pictures causes endless loop
- Related: tdf#157590 sw floattable: avoid a bit of not needed work
- sw floattable: fix nullptr deref in TableManager::endLevel()
- tdf#99822 sw floattable: allow nomimal overlap of objects from different cells
Want to start using this?¶
You can get a snapshot / demo of Collabora Office 23.05 and try it out yourself right now: try the unstable snapshot. Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF's next release too (24.2).