Estimated read time: 4 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 sixth post for the previous part.
Motivation¶
The current post features sub-tasks for the multi-page floating table work that is around an explicit table overlap control that Word has (and Writer lacked so far), compatible border rendering of split tables and having footnotes in floating tables, which was not working previously.
Results so far¶
Regarding testing, the core.git repository has 60 files now which are focusing on correct
handling of floating tables (filename 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 the anchor paragraph of a floating table had some autotext (e.g. "dt", which stands for dummy text), and pressing the relevant shortcut (F3) expands that autotext with the actual content. This includes changing the anchor position of the floating table, which lead to overlapping text. (A multi-page floating table has multiple anchors, we have to make sure we don't set all of them to the new value as-is.)
The next screenshot shows a case where two tables are positioned in a way that they would overlap. Word has a flag that asks the layout to still re-position the second table so the overlap doesn't happen, and now Writer supports this as well.
This screenshot shows a bug where the anchor text on the first page was also duplicated on the second page. Now we properly start the anchor text on the last page of the floating table, like Word does.
What you can see is a floating table that has 2 pages, but simply a split of the table would result in no bottom border on the first page and no top border for the second, like perhaps you would expect it, matching Word. This is now fixed, the layout infers the border style in those cases correctly.
The last screenshot shows a mini-feature: it was possible to float tables and to have footnotes in tables, but not both at the same time. The screenshot shows a case where a floating table is needed, so a specific paragraph is above the table. But we couldn't float the table, because it had a footnote and that would be lost as-is. Now you can have a correct position for that paragraph and the footnote is there as well, at the same time.
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#156350 sw floattable: fix bad additional draw:frame in ODT with layout
- tdf#156260 sw floattable: avoid overlapping flys on anchor change
- tdf#156260 sw floattable: avoid moving text from the last anchor to its precede
- sw floattable: simplify collecting frames at node with layout
- tdf#156349 sw floattable: fix caption insert for tables inside split fly frames
- sw floattable, crashtesting: fix PDF export of tdf73201-1.docx
- tdf#156589 sw floattable: fix follow fly moving inside a table on the next page
- sw floattable: import w:tblOverlap w:val="never" from DOCX
- sw floattable: handle AllowOverlap==false in the layout
- sw floattable: export w:tblOverlap w:val=never to DOCX
- sw floattable: handle AllowOverlap==false in the DOC filter
- sw floattable: handle AllowOverlap==false in the RTF filter
- tdf#156682 sw floattable: fix missing del of master anchor para por on split
- Related: tdf#156351 sw floattable: fix missing top border in follow table
- tdf#156351 sw floattable: fix missing bottom border in master table
- tdf#77760 sw floattable: add support for footnotes, doc model
- tdf#77760 sw floattable: add support for footnotes, layout
- tdf#77760 sw floattable: add support for footnotes, DOCX import
- sw floattable: don't split if anchored inside a footnote
- tdf#77760 sw floattable: add support for footnotes, DOC import
- tdf#77760 sw floattable: add support for footnotes, UI
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).