Writer : minimize / optimal column width has no effet

Hi,

I want the width of my table to automatically match its content. Right now my table always fits the width of my page. “minimize / optimal column width” (under “Optimize size” in table toolbar) seems to be what I’m looking for, but it just doesn’t do anything.

Is this a known bug or am I missing something ?
Tested on : 6.4.3.2 and 6.3.4

Thanks,

Paul

edit : It seems not to work with the specific case of one-column table layout. Here’s a screenshot : https://i.ibb.co/QCp4tBg/Untitled.png

You need to first “grant freedom” to the table width. For that, in the table properties, under “Table” tab, change the alignment property from “automatic” to “manual.” Now you can select the table and use the “minimize column width” option. And yes, it’s a bit weird that the width of a table is linked to its alignment, but once you know, it’s easy to use :wink:

Note you cannot type to the side of the table unless you put it inside a frame.

Thanks ! As I wrote in my comment to ajlittoz answer, I have being able to use the feature with this setup, but it still doesn’t work with one column tables.

Tables in Writer work the other way round.

When you insert a table you reserve some space out of the page. This space is divided into columns (you chose their number when creating the table). Then text is added into the cells and line wrapping occurs when text reached the cell boundary. The only “dynamic” factor is the vertical axis: lines are allocated to hold the text, increasing cell size and eventually spilling over on next page in a copy of the table with same properties.

You want to match text content. But what is the size of text? In ordinary paragraphs (outside tables), margins define the horizontal size inside which text is formatted. Margins don’t adapt to a partially filled line. And what would that mean for a multi-line paragraph? On which general criterion would Writer to decide to format your paragraph as an 8-line para instead of a 5-line para. Only you can do that, intentionally modifying paragraph indents (that’s the name for the additional “margins” between page margins and paragraph limits).

The first task is to decide for a total table width.

By default, tables use the full page width between margins. If you don’t like it, put the cursor in the table and Table>Properties. In Table tab, choose any Alignment other than Automatic. You can then force a width and optionally offset the table if it is not flushed left or right or centred. Columns width are manually set in the Columns tab.

But, according to your question, you don’t want to go for the manual procedure.

Select the group of contiguous columns you want to adapt. Then press on the table toolbar button. The narrow icon will shrink the sparser columns to minimum, the fat icon will distribute uniformly and the remaining icon (with double arrow) will do something in-between, so called “optimal”.

What you probably missed was first to select a group of cells.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

Thank you for the exhaustive answer.
I was able to manually set my table width as you described, but indeed, I’d like to use the automatic solution for consistency. I tried to do as you described. My table, which is a one column table, is desperately sticking to page width… Weirdly, I just noticed that the feature works as expected with other tables layout. Added a screenshot to my question.

Thanks !

The redistribution of width is meant to work on multicolumn table without the hassle of going into Table>Properties and its tabs (with sometimes unexpected or unwanted interaction between column.

A single column table is a simple case which IMHO does not make sense. It can be handled more flexibly with an adequate paragraph style. And you have the added advantage that a simple double click or selection from the paragraph style drop-down menu immediately formats the selected paragraph(s). More over, you are guaranteed that all such paragraphs have exactly the same formatting.

However, if your goal is to center a title and draw a border around it, not exceeding the width of the title (plus an optional padding), this can’t be done automatically. The border is drawn around the paragraph from indent to indent, no matter the effective length of the title. This can be mitigated with a character style for a background color (no padding, alas). But choose one not both or result is ugly.

I’m using this to caption illustration / formula. This would ensure that caption is within a box whose width is at least illustration’s width, and wider if needed.
(Caption / frame have default fixed width and have a tricky layout)
As you said, paragraph style and character border won’t give me what I’m looking for either.
I don’t think my use case is that weird, and more generally, I think a one column table is a valid concept, as is fitting its width to some fixed size content.
For now I think I’ll go with adding two lateral columns.
Thank you very much :slight_smile: