Bug 118274 - TABLE: Table styles should include table alignment
Summary: TABLE: Table styles should include table alignment
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: Writer-Tables-Style Writer-Tables-Alignment
  Show dependency treegraph
Reported: 2018-06-20 16:24 UTC by Phil Krylov
Modified: 2022-11-22 09:26 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

A demo document (9.67 KB, application/vnd.oasis.opendocument.text)
2018-06-20 18:18 UTC, Phil Krylov

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Krylov 2018-06-20 16:24:19 UTC
When creating a new table style from selection, the table alignment property is not stored in styles.xml. When applying the style to a table, the table alignment proerty is not applied.

Steps to Reproduce:
1.Create a table and set its alignment to Centered
2.Create a new table style based on that table
3.Create another table and try to apply that style to it

Actual Results:
The table is left-aligned

Expected Results:
The table should be centered

Reproducible: Always

User Profile Reset: No

Additional Info:
Build ID: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf
CPU threads: 4; OS: Mac OS X 10.9.5; UI render: default; 
Locale: en-US (en.UTF-8); Calc: group
Comment 1 Dieter 2018-06-20 18:00:44 UTC
I could apply the style in

Version: (x64)
Build ID: 0f4d2060bc90b4008fbc8e6d9a49ec7eeea60b78
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
Locale: en-US (de_DE); Calc: CL

and also in

Version: (x64)
Build-ID: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc: group
Comment 2 Phil Krylov 2018-06-20 18:18:15 UTC
I also can apply the style, but the style does not include table alignment so it does not apply Center alignment to the table. Attaching a sample document, where I created the upper table, centered it by going to Table Properties - Table - Alignment - Center, then I created the "centertable" table style from it (selected the table and clicked "New Style from Selection" on the Table Styles tab of the Styles and Formatting sidebar), added the bottom table and tried to apply the "centertable" table style to it.
Comment 3 Phil Krylov 2018-06-20 18:18:52 UTC
Created attachment 142977 [details]
A demo document
Comment 4 Dieter 2018-06-20 19:03:06 UTC
These are my steps:

1. Table => Insert Table => Insert
2. Mark all cells
3. Align center
4. Sidebar => Styles => Table Styles => New Style => Style Name "center" => OK.
5. Table => Insert Table => Choose a style => Insert
6. Cursor in table => Choose style "center" from table style list => table is aligned to center

Perhaps you should try to reset your user profile.
Comment 5 Phil Krylov 2018-06-20 20:14:34 UTC
I think that by step "3. Align center" you are setting center alignment for _paragraphs_ inside table cells (Format - Align - Centered), but what I meant by setting center alignment for table is "Table - Table Properties - Table - Alignment - Center".
Comment 6 Dieter 2018-06-20 20:55:09 UTC
Now it's clear to me. I can confirm the observed behaviour. I think this is more an enhancement than a bug. I'm also not sure, if it is possible to add table alingment to table styles. So I don't want to change status to NEW. Perhaps some more experienced user knows more about it.
Comment 7 Regina Henschel 2018-06-20 23:23:19 UTC
Currently the "table styles" in the Styles&Formatting dialog are not styles in a technical sense, but they are table-templates. Such table-template is a set of cell formatting information, each of them for a special group of cells, e.g. the first row. Such cell formatting information contains a reference to a table cell style and a reference to a paragraph style. But the table template cannot have a reference to a table style. And the alignment information belongs to the element <style:table-properties>, not to the element <table:table-template>.

LibreOffice has only a rudimentary implementation of table-styles. It always writes the information as automatic-style, that is the way to write hard formatting. And if a file uses "true" table styles, LibreOffice does not understand it. The file format allows table styles as "true" styles, including inheritance and the possibility to use the same style for different tables. But LibreOffice has not implemented to use it.

The UI will be tricky, because tables refer to two sources for their formatting, an element <style:style> of family "table" and an element <table:table-template>. 

So it is a valid request, to implement the use of true table styles.

There exist bug 34391 about "table styles". But in fact the entire comments in it are about table templates. Therefore I think, it is better to keep this bug report for "true" table styles. A "true" table style is an element <style:style> of family table as child element of element <office:styles>, in contrast to the current implementation as child of element <office:automatic-styles>.
Comment 8 Heiko Tietze 2018-06-22 08:40:58 UTC
(In reply to Regina Henschel from comment #7)
> ...
> So it is a valid request, to implement the use of true table styles.

I would close this ticket as WF and create another. Don't think we will have "real" table styles at any time.
Comment 9 Regina Henschel 2018-06-22 11:07:05 UTC
(In reply to Heiko Tietze from comment #8)
> I would close this ticket as WF and create another. Don't think we will have "real" table styles at any time.

A missing feature cannot be "worksforme" and why another report? This is a feature request about table styles. "at any time" might be true, as someone has to pay for it. But keep in mind, that we currently have three different ways to format a table,  and that table styles are an ODF feature, which is not implemented, and LO would fail on foreign documents, which use it. Therefore I think a refactoring is needed, and it is worth to keep this ticket.