Autosize table columns to cell contents?

In Word, you can autosize table columns to cell contents. The cells start out very narrow, and they grow as you type. Is this possible in Writer? I haven’t seen a solution on forums.

The default for tables in Writer is to span the page with evenly-spaced columns. You can of course, drag the table smaller or adjust in Table Properties.

Regardless of width of the table, if you have more content in some columns than others you can select the table and click Table > Size > Optimal Column Width or click the appropriate icon. Cheers, Al

image description

That’s pretty good. I made a macro and keyboard shortcut to do:

  • Table > Select > Table
  • Table > Size > [Minimize Column Width].

But this doesn’t work when the table is one column. I have to resize the table width manually.

Why would I create a table with one column? It’s a way of getting a frame around some text.

In that case why don’t you use a Frame? Insert > Frame > Frame, in the dialog box define: vertical and horizontal size or Autosize either or both, maybe keep ratio, position of Frame, borders, the lot.

Because I’m new to Libre Office and didn’t know about them. I just looked at them quickly, and might have a lot to learn. But I don’t like that frames float. I only want to use simple, standard techniques, so that when I save as Word 2000 format (which my friend uses), there will be no problems.

Better not use Frames then. Sorry, can’t help on resizing single column automatically.

You could select your text outside of a table and click Format > Character > Border > Set all four borders. Select the text, in the sidepane click on Styles, select the Character Style pane, under Styles Action select Create New Style from Selection, call it BorderText and OK. You can now select some text, double-click the Character Style, BorderText, and the text will get a border. Note that if you exceed a single line then each line will have a border which will extend only as far as the end of the words, which might not be what you want

Thanks for that, but I’m not sure it’s easier than manually resizing the table after I finish typing. Also, it’s comforting to type the text within a frame. I have an idea that I’ll try: In a macro, add a second column, then run Minimize Column Width, then remove the second column… Ok, I tried it, and it doesn’t work because the table size didn’t shrink. Later, I will try: adding a second column, running Minimize Column Width, saving (somehow) the width of the first column, deleting the second column, and setting the table width to be the saved width.