Style your tables
Introduction
Tables are one the most frequently used objects in documents. If you want to present data in a structured way with, for instance, small gridlines, a nice header, right aligned numbers, and highlighted totals- that’s a table. And if you need a unique branding defined by your company or just want to have a consistent look and feel you have to apply all those formattings exactly for each table. But that’s not how text processors work. And of course Libreoffice has a table style right now, or rather kind of, but well hidden and not really accessible.
Current situation
In order to apply a style to a table you have to select it, go to the main menu > table and click autoformat (actually it is labeled incorrectly with camel case as AutoFormat). The dialog offers some presets along with checkboxes where you can uncheck the properties you do not want to apply.
In order to add your own table style you have to format a table as you like, start the autoformat dialog and click add, which allows to store the own configuration. Unfortunately there are some snares…
ODF Specification
The OpenDocument Format specification provides the necessary tags needed to implement table styles under the <table:table-template> element which goes in <office:styles> in styles.xml. Below is the list of tags sorted in the order of priority of it being applied to a cell
- First column style: <table:first-column>
- Last column style: <table:last-column>
- First row style: <table:first-row>
- Last row style: <table:last-row>
- Alternative row style: <table:even-rows> and <table:odd-rows>
- Alternative column style: <table:even-columns> and <table:odd-columns>
- Base style: <table:body> and <table:background>
Other useful tags related to table styles include <style:table-properties/>, <style:table-row-properties/>, and <style:table-cell-properties/>
Issue
This current solution has several drawbacks. First of all it is actually not a style but applies as direct formatting to the existing table. That means it would need to be reapplied if the table was modified (e.g. if a new row was added). This is true for Writer and Calc but not Impress. This program has a ‘Table Design’ section in the properties tab of the sidebar, which allows the users to select from 11 table styles and then tweak the style by enabling or disabling various sections of the table. Unlike autoformat, that style is attached to the table and it does not suffer the same problem of the style not adapting to a change in the number of rows in the table.
- No common dialog and workflow (tdf#34391, aoo#11121)
- Style should be independent from the content, e.g. for alternating rows
- There is no access from sidebar in Writer and Calc (tdf#95279, tdf#86177)
- Styles are not imported and not preserved after Roundtrip (tdf#94076)
Proposal
First drafts included not only options to change a style but also the list of all predefined styles in order to apply it to the table. But actually that makes no sense because this dialog does not aim to switch between styles – this function is preserved for the table format dialog and the sidebar. The table styles dialog would be opened to manage the style only not to modify the actual document.
Since we anticipate that only a few properties of an existing table style will be changed it makes sense to introduce inheritance. That means, for instance, to load the Blue style and modify the footer row only. Doing so you may want to know from what style the current design was inherited and which properties have been changed actually.
That’s the summary we show on the left hand of the mockup. You can rename the style and you get the summary of changes plus the WYSIWYG preview. The content area contains of a dropdown to select the elements (odd/even row/column, header, footer, first and last column) with all respective properties below. The checkbox enable controls whether or not this element is part of the style.
Quick access to the predefined styles is available from the sidebar (and perhaps also via context and main menu). To apply a table style you would go to the styles section of the sidebar and select tables there. Per double-click or apply from the context menu you activate this style (not effective respectively disabled when no table is selected). Per new or change you access the properties dialog, the second with inheritance.
Furthermore, the paragraph tab would get another content panel for tables where you have access to the styles (perhaps also with the option to add or change a style). For convenience there are the major relevant functions available, that is add/delete rows and columns as well as merge and split cells (of course the themed icons should be used later). And last but not least tweaking the most frequently changed property – cell background – is possible here as well.
Finally we should also think about having access to table styles from the common table format dialog.
Discussion
The proposal deals with a couple of ideas to improve the handling of table styles. First of all the style needs to be applied as such (work has begun). Depending on what is possible in respect to the ODF specification we suggest to inherit a style from another, similar to what is known from paragraph style. We tried to achieve consistency for the dialog- the two column layout, a WYSIWYG preview, and a predefined placement of controls should become the default, where possible.
What do you think about this proposal? Code in haste, repent at leisure is what we want to avoid. So don’t hesitate to dump your opinion.
I know you do a great job but it looks quite complicated. I would say for an company cooperate design template development it is ok but for an standard user quite complicated.
Is it possible to design a table in calc and than select the table with header, fooder, … and say save as template orange.
In addition what do web developer. In my point of view the style stuff in office products (all) are more complicated than for web development.
What I also don’t like (in your mockup and also in MS Excel) that everybody know how to style an table within an calc sheet and when you make an template it is a different workflow why you can show the user an empy calc sheet with header, body, fooder description and there the user can make the style like in his sheets and finished. like I wrote select an finished styled table and say use it as style template.
or you can say make a new style template open an new stylesheed with header template text and so on and the user make the style stuff there and when finished say save style orange (like master page view in powerpoint)
>Is it possible to design a table in calc and than select the table with header, fooder, … and say save as template orange.
That’s how it works today. At least in Writrer you can create a table as you like and ‘add’ this to the autoformat styles (despite the fact that it isn’t a style but direct formatting). However, there is no option to change this style beyond disabling features. And the workflow today is very uncommon. And of course you are right: We should try to do the configuration more visual.
About simplicity: The proposal allows to apply a table style from the sidebar. Is this easy and sufficient for you?
I test it and I can’t design an table and than say use it as templete.
my problem is that it is different in writer, calc, impress, … I don’t want to have simplicity cause it is good. I want an workflow the user can remember also 1 year after they use it. and as LO is an suite it should be the same everywhere.
We have to start somewhere with table styles and the most important place to start is writer and once it is completely, it can hopefully be ported to the other modules.
Ideally, a document should be definable using only styles. Please take a look at the following example:
http://blog.alvarezp.org/files/cell-style-explanation.png
The picture describes a table where a particular set of cells use the same cell format (specifically, area and border spacing). Ideally a “cell style” would be used, as those attributes can’t (and shouldn’t) be set in any other style.
Is this use case in or out of the scope of the proposal?
Table styles are not applied cell-wise. It works on even/odd rows and columns, first and last row/col etc. The good news is that your 4×4 table has one first and one last column as well as header and footer. So your table actually has only one odd/even item – sized with 4×4 cells. So yes, it works (right now).
That’s really great.
I wonder whether it would also be possible to allow defining styles on particular columns/rows. For example, I often need to replicate a table with e.g. column 1 of a given width and bold text, column 2 with another width and percentages, etc. The principle of even vs. odd rows/columns is great when they all have the same status (i.e. a list of variable length), but when they have each a different meaning you’d rather describe them individually. I’m not sure what can be done in ODF about that. This sounds like an intermediate between formatting a table manually and completely automating a style.
How about some really nice looking default table styles? The defaults in Libreoffice Writer look really awful. Competing products such as Microsoft Word have much nicer looking default table styles.
Absolutely. If you have something special in mind feel to share with us. The table styles feature is being under rework currently, so there is a good chance to get new designs into the next release.
I agree with John Smith,
most user do not want to be able to customize everything : padding, margin, border-with, in a style.
They just want to have default template they are quite good (have a look at MSOffice) and change directly what they want.
IMHO creating/editing/saving it’s own template is a much more advanced feature that very few will use
is any of this available in any beta version. will row highlighting work when I add a new row or will I have to reapply the style
The table style feature has been realized in one of the GSoC projects and will be available in 5.3. You may test it with the nightly builds [1], but be aware there is still some fine-tuning ongoing.
https://www.libreoffice.org/download/pre-releases/
I think is very usefull and necesary. This is one reason because I prefer Microsoft Excel…
I’m not understanding why so many places to access and configure tables. If I’m dealing with a table I should only have to go ONE place to either manage styles, select them, or anything related to tables. Are tables paragraphs? No, they *should* be separate objects. So why a ‘table’ tab in the paragraph settings? Certainly, one could set the wrap around a table to appear as if it lies in a paragraph, but a table shouldn’t BE a paragraph and so the paragraph settings isn’t where I’d think to look for anything table related. Why separate managing table styles and table preferences? (I don’t get the separate Styles & Formatting dialog either – EVERYTHING in word processing is practically styles and formatting. Having some default overriding style rule that isn’t changeable by the normal dialogs is the most maddening thing about LO)
As for Calc, if I decide to apply a default style, make my own style, or tweak an applied style, ALL of these things should be possible from one place, not separate dialogs.
Just my 2¢.
We should actually just open a new window with a table 5 rows x 5 columns (simple document) with table toolbars and to allow a user to format it as he/she wants. Later, script just collect the needed information (border size, first row shading, last row shading etc.)
so I’ve been trying to create a custom autoformat for a table that is used as invoice template by Fakturama.info sofware and even after messing around with it for like 3 hours or longer I’m unable to achieve the desired look. For one, creating a autoformat from within Writer didn’t work for me as it didn’t pick up the backgrounds and what not. So I had to go into Calc and create the autoformat there. But now when I apply it it will always mess up my alignments, cell paddings and what not, every time a new row is added to the table, regardless if I have the according checkboxes in the “autoformat select dialog” enabled or disabled when I apply that style.
I would really appreciate more advanced features like they have been proposed here instead of this IMO really awkward and error prone way. I need a way to tell the style if the alternating row color should be applied from last line or first (after the header), if there should be a footer line or not etc etc. Those are all things the current “user friendly” (please read it with a grain of sarcasm) way lacks and prevents professionals from creating good looking and well designed documents. If the current approach would be userfriendly I would have achieved my goal hours ago ;)
So please add more professional features to manipulate the autoformat styles or provide a way to mess around with the XML or whatever format those are stored in.
Thanks.