Index ¦ Archives ¦ RSS

Multi-page floating tables in Writer: keep together or not

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 11th post for the previous part.

Motivation

Previous posts described the hardest part of multi-page floating tables: making sure that text can wrap around them and they can split across pages. In this part, we'll look at a conflicting requirement. On one hand, headings want their text to not split across pages (and shapes anchored into paragraphs are considered part of the paragraph, too). On the other hand, it should be OK to have a floating table at the bottom of a page and the following heading to go to the next page.

It turns out, Writer gave "keep together" a priority, while Word gave "floating tables are OK to split to a previous page" a priority.

Note that if you have a shape (e.g. a triangle) and not a floating table, then both Word and Writer prevents the move of that shape to a previous page (if the shape is anchored in a heading); this difference was there just for floating tables.

Results so far

Here is how the tdf#167222 bugdoc looks like now in Writer:

Floating table, followed by heading: new Writer render

And here is how it used to look like:

Floating table, followed by heading: old Writer render

And here is the reference rendering:

Floating table, followed by heading: reference render

This means that we leave layout for shapes unchanged in general: shapes anchored in headings are still considered to be part of headings and don't split. But for floating tables, we now allow them to split and use space at a previous page if they fit there.

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:

Want to start using this?

You can get a development edition of Collabora Online 25.04 and try it out yourself right now: try the development edition. 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 (26.2).

© Miklos Vajna. Built using Pelican. Theme by Giulio Fidente on github.