Ask Your Question

difference between styles and automatic-styles [closed]

asked 2014-04-11 11:56:40 +0100

stla gravatar image

updated 2014-04-11 11:57:30 +0100

Hello, I'm creating an odt document by writing the raw code in content.xml. I don't understand what is the difference between defining a new style in the <office:automatic-styles> block and defining a new style in the <office:styles> block ?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-20 20:08:50.298907

1 Answer

Sort by » oldest newest most voted

answered 2014-04-11 14:44:49 +0100

Regina gravatar image

Do you have already download the specification?

Here some quotes from section 3.15, part 1.

In 3.15.2 office:styles

The office:styles element contains common styles used in a document. A common style is a style chosen by a user for a document or portion thereof.

In 3.15.3 office:automatic-styles

The office:automatic-styles element contains automatic styles used in a document. An automatic style is one contains formatting properties that are considered to be properties of the object to which the style is assigned.
Note: Common and automatic styles behave differently in OpenDocument editing consumers. Common styles are presented to the user as a named set of formatting properties. The formatting properties of an automatic style are presented to a user as properties of the object to which the style is applied.

In short, office:automatic-styles corresponds to direct formatting of an object and office:styles correspond to the settings via style&formatting window. Although automatic styles "are considered to be properties of the object" it is not forbidden to use the same automatic style for more than one object. You have no UI for doing so, but you can do it in the file itself.

edit flag offensive delete link more


Thank you. Does that mean that office:styles is useless in order to write the raw code ? I can put everything in office:automatic-styles ?

stla gravatar imagestla ( 2014-04-11 16:58:43 +0100 )edit

No, it depends on the attribute and element. It is mentioned in the spec, when automatic-style is not possible. Or you look into the Relax-NG schema, to see whether it is allowed or not. Compare element name="office:styles" (~line 493) to element name="office:automatic-styles" (~line 550).

Regina gravatar imageRegina ( 2014-04-11 17:18:41 +0100 )edit

I really don't understand. The only styles I define are styles for paragraph, text, tables, pages. What is the best option for such styles ?

stla gravatar imagestla ( 2014-04-14 16:33:48 +0100 )edit

@stla, if you are creating files that will be edited later by humans, not software, the best option is <office:styles>, as the user will be able to choose the styles inside the document to edit it consistently. <office:automatic-styles>, which are invisible to the human user, are only used when the (human) user apply the formatting directly to the object (character, paragraph, box etc.). I think the specs were defined this way to avoid ambiguities between software reading and writing documents.

João Paulo gravatar imageJoão Paulo ( 2014-09-09 06:08:30 +0100 )edit

Question Tools

1 follower


Asked: 2014-04-11 11:56:40 +0100

Seen: 1,097 times

Last updated: Apr 11 '14