Bug 164639 - Writer ignores table styles defined inside styles.xml
Summary: Writer ignores table styles defined inside styles.xml
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.8.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Tables-Style
  Show dependency treegraph
 
Reported: 2025-01-09 15:32 UTC by marco.bettini@ttsolutions.it
Modified: 2025-01-13 18:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Minimal ODT file with table style defined in content.xml (3.02 KB, application/octet-stream)
2025-01-09 15:35 UTC, marco.bettini@ttsolutions.it
Details
Minimal ODT file with table style defined in styles.xml (3.56 KB, application/octet-stream)
2025-01-09 15:35 UTC, marco.bettini@ttsolutions.it
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marco.bettini@ttsolutions.it 2025-01-09 15:32:31 UTC
Description:
Automatic styles for table elements (columns, rows, cells, table itself) defined inside the styles.xml file are ignored by LibreOffice Writer. The same style defined inside of content.xml is correctly applied instead.

For example, a very simple table style defining an orange background:

<style:style style:name="SampleTableStyle" style:family="table">
    <style:table-properties fo:background-color="#ffb66c">
    </style:table-properties>
</style:style>

defined inside the <office:automatic-styles> tag in content.xml and applied to a table

<table:table table:name="SampleTable" table:style-name="SampleTableStyle">
    <table:table-column />
    <!-- rest of the table -->
</table:table>

correctly produces a table with an orange background when viewed inside LibreOffice Writer.

The same style defined inside styles.xml (and an empty <office:automatic-styles> tag in content.xml) leads to a table with a default white background.

Reading the ODT 1.3 specification I can not find any mention of table style definitions only being allowed as part of content.xml. 

Steps to Reproduce:
1. Create a table inside of content.xml and assign a style to one of its elements.
2. Define the newly assigned style inside the <office:automatic-styles> tag in the content.xml file.
3. Build an ODT file which includes content.xml.
4. Create a styles.xml file and copy the style definition found in content.xml.
5. Remove the style definition from content.xml.
6. Build a second ODT file including both content.xml and styles.xml.

Actual Results:
The first ODT file (the one including only content.xml) shows the style correctly applied to the table element, while the second where the style definition has been moved to the styles.xml file shows a table lacking any style.

Expected Results:
Both files should display identically.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.8.4.2 (X86_64)
Build ID: 480(Build:2)
CPU threads: 16; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: it-IT (en_GB.UTF-8); UI: en-US
Calc: threaded
Comment 1 marco.bettini@ttsolutions.it 2025-01-09 15:35:06 UTC
Created attachment 198449 [details]
Minimal ODT file with table style defined in content.xml

This file has been validated to be ODF 1.3 compliant.
Comment 2 marco.bettini@ttsolutions.it 2025-01-09 15:35:42 UTC
Created attachment 198450 [details]
Minimal ODT file with table style defined in styles.xml

This file has been validated to be ODF 1.3 compliant.
Comment 3 Regina Henschel 2025-01-10 14:22:57 UTC
A can confirm it for Version: 24.8.3.2 (X86_64) / LibreOffice Community
Build ID: 48a6bac9e7e268aeb4c3483fcf825c94556d9f92
CPU threads: 32; OS: Windows 11 X86_64 (10.0 build 26100); UI render: default; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded

The problem is only for package format. In flat format there is only one <office:automatic-styles> element.

This is a problem not only for tables. If you move e.g. an automatic style for a paragraph from content.xml to styles.xml it is detected neither.
Comment 4 marco.bettini@ttsolutions.it 2025-01-10 14:48:06 UTC
Something different but related to this bug: the ODF 1.3 spec allows styles for table elements to be defined both as common styles (i.e. inside <office:styles>) and as automatic styles (i.e. inside <office:automatic-styles>).

However, table styles defined inside <office:styles> put into a styles.xml file are ignored by Writer.

Not sure whether this is something related to the bug in OP (the content of styles.xml is ignored) or a Writer limitation as there is no proper GUI to handle common styles for table elements.