Custom text alignment in first table row

In Writer, I want to create a table whose first row contains center-justified text, but all the remaining rows have left-justified text. Is there a way to do that? (I observe that I can select the first row, and choose center alignment, and it looks the way I want; however as soon as I modify the table by adding a new row, the first-row alignment immediately reverts to left-justified.)

The intended way is to set the paragraph style for the first row to Table Heading. This is an option in the insert table dialogue

I did that. But the alignment doesn’t stick. As soon as I add a row to the table, the alignment of the elements in the table heading row reverts to left-justified.

May I ask what version of Writer you’re using? I’m doing what you’ve described, and for me it’s working as intended (first row remains center-justified).

I always use the None table style. The other styles have macros to force the chosen style on the table so it will always change the table to the selected style. I never use them nor the AutoFormat Styles for tables.

Note that you can create your own style but it defines the first row, the middle rows and the last row from what I remember last time I used it.

If you wanted to change your table style to None, you could select the entire table and click Table > Convert > Table to Text (separate at tabs) and then select that text and click Table > Convert > Text to Table. Then select the first row and set the paragraph style for that to Table Heading

1 Like

This is my version info:
Version: 7.4.2.3 / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 10; OS: Mac OS X 12.6; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

As mentioned by @EarnestAl, so-called “table styles” are not your friends when you have custom layout/format specifications in your tables. “Table style” macros will insist on imposing their choices, overriding yours. Always prefer bare metal tables (None table style) and then format with your own paragraph styles.

Built-in paragraph styles provide Table Heading and Table Contents to differentiate first row from the others. Assign the styles and customise them to fit your taste.