Writer: formatting tables with user named styles?

Hi all,

I write documents with many similar tables which follow only very few “templates”, say less then 5. What defines a “template” is the number of columns, their widths, the spacing around the table, …, in short what we find under TableTable Properties.... The main variant between tables from the same “template” is the number of rows.

When creating a new table, all the parameterization must be manually repeated. It would be nice if the TableInsertTable... offered a Style drop-down menu like, for instance, InsertManual Break..., provided of course table “templates” can be defined as styles like frames (which seem to me the closest to what i’m looking for).

Content of cell (formatted text, at least) can be set with paragraph and character styles, so that the “inner” appearance is uniform and consistent among the tables.

But the question of maintaining/updating the general “outer” aspect of a table remains open: it is a manual and individual task on every table. With a named table style, a change in a parameter of table properties could be automatically propagated to all tables. This would really ease the task of the editor who tries to give “corporate look” to the document.

I searched this site about this topic and found many related questions. It seems some work is in progress but even in fdo there is very few information about the direction it is taking.

Answers suggest to use TableAutoFormat... but this does not seem to provide what I need: number and size of columns are not kept in the format. Also, most important for me, the autoformat is not editable (one has to delete and recreate it) which precludes my use as a true-style surrogate.

Is there presently any workaround or should I wait and hope the feature will come in a reasonable feature? (I know development is done by volunteers and I don’t blame them for fixing bugs first.)

At least is there any preliminary specification since the definition of a table style can be as varied as there are LO users?

LibreOffice 5.3 now has table styles.

As you already found, there is an ongoing effort to provide table styles in Writer. When the results of that effort will be finally presented and how many of your requirements will be covered, I don’t know.

But for the time being, there is a partial workaround for your problem: use AutoTexts.

AutoText is the same tool you can use to insert a dummy text by writing the shortcut “dt” (without quotes) and then pressing F3, or a table containing a Math object and a number range with “fn” and then F3. As you can see Autotexts can hold any kind of content so you could format a table as you like, select it (pick at least an empty line before and another empty line after the table, otherwise it will not work) and then go to Tools → AutoText to give it a name and a shortcut.

Autotexts can be easily edited from that menu, but changes will only apply to newly inserted autotexts, not to old ones. I’m not aware of any workaround to maintain format consistency on all the inserted tables.

Thanks for the AutoText tip, I’ll try that to see how it fits in my workflow

The problem with table styles is that you will need to change the definition of the Open Document Format, and that will need a lot of more coding as well for handling the new styles type. Just think of the necessity for downwards compatibility so that later versions of LibreOffice and Apache OpenOffice can read both files with and without table styles and you probably get the idea.

An easy workaround is to use copy & paste, if necessary from a dummy template file holding all the blank tables that you need.

A bit more involved would be a table wizard that allows you to select a table from a set of templates. That set should be built by another wizard that you run when you install Libre or when you want to add table styles. The wizard would use macros to insert and format the table.

No offence intended, I don’t like the “not in ODF format” argument. I understand very well the necessity to agree on a common representation of a document so that it can be exchanged between platforms and applications, but it must not be a bridle to desirable evolution. I feel that the problem does not lie in table creation (because properties can be copied “one-shot” from the style to the document XML stream, leaving the style in some non-ODF dictionary) but in the aftermath of style update.

Copy & Paste is my present method, but it is a real pain to track all tables to propagate spacing around or column width :frowning:

  1. You didn’t get the point. I wouldn’t mind updating the ODF definition myself, if there were enough developers around to do all the hard work necessary to get that working. You probably have no idea of how many bugs there already are that really need to be fixed, and I don’t want to think about how many new bugs can be introduced if you don’t do this update properly.
  2. I toyed with AutoText but didn’t think of selecting paragraphs above and below the table or I’d have added that option.

I got the point, I’m also in FOSS development. The worst issue for an application (and it is even worse for free software) is to release it with blocking bugs, it is the most reliable way to kill it. First priority is to have it acting like the manual (or specification) says. Beyond, we can have wishlists. And there begins difficulty: interactions or conflicts with standards, integration with existing implementation, resources available …

LO is such a high-value product, kind of pre-DTP!

I would like the same feature. Has there been a progress in this?

I saw in the ODT specification that there is a format/tag to implement table templates. Is this supported? If it is not supported in the GUI would LibreOffice Writer use a table template to create new tables if it finds one in an ODT document?

(So if I add a table template manually by changing the xml code of styles.xml or if I use some kind of tool to create the table template would LibreOffice Writer make use of it?)

On 5.3.x you can apply some predefined table styles, but there is no UI to create or even edit them. It is possible (sort of) to create new styles by using the Table → Autoformat dialogue, but the results are quite limited. See this meta bug for a list of related reports / enhancement requests

Bug 101756 (Table-Styles) - [META] Table styles bugs and enhancements