writer: importing styles from file not copying all style attributes

In writer: Can someone please confirm whether the following behaviour is accurate?

  1. Import styles from file to new document. Using Styles (menu) → Load Styles
  2. import works fine. except some styles do not have all their font effects applied. For example “casing set to uppercase” is not importet.
  3. this may not be the only property which is not copied across.

This results in a loss of formatting information where the style in the recipient document is incomplete and does not include all formatting.

Please note that copying a style assumes that all attributes editable by right-clicking on “modify…” [style name] under the styles pane (F11) are supported to be copied / transferred to a new document.

Can someone confirm this is a problem or a fix for this?

Why do you need a confirmation for a bug on the Ask site? If you have found a bug, please file it to bug tracker. Asking for confirmation here is duplicating the effort (people do something to reproduce here, then people do something to reproduce on the bug tracker anyway), thinking that time of volunteers here is less valuable than that of volunteers on the bug tracker?

Before reporting a bug, make sure the Overwrite box in the import dialog is checked: if it isn’t, styles with same name are not imported and you end up with the pre-existing definition in the “importing” document.

A much more reliable way to format consistently and uniformly a set of documents is to base them on a template. Whenever you update your template, the style changes are forwarded to the documents as soon as you open them.

Basing a document on a template (when this has not been done from the start) can be done any time with the DocumentTemplateChanger extension.

1 Like

If you want someone to test, at least, you must provide a test case. Read this and this.

This is still a problem with newer versions of LibreOffice. I have experienced it since (at least) version 6, possibly earlier. I’ve seen it on multiple computers and operating systems (Windows 7, Windows 10, various versions of Ubuntu), etc.

Here is what I have observed on nearly a daily basis for years:

  1. Open a document and import styles and check all the boxes to overwrite everything with the new styles. All the styles are usually imported (meaning that if you right-click on a style in the Styles window and go to “Modify” – all the settings for the style will appear to be correct). But only some of the styles in the original document will actually be overwritten. So when you look at the document, much of it looks exactly the same as it did before importing new styles. All the “new” styles need to be applied manually to the document.

  2. Sometimes this is due to the fact that the original document and the doc you’re importing styles from have different names for certain styles or a different hierarchy of “parent” styles. In this case, LibreOffice is behaving as expected: only styles with the same names and hierarchical structure are overwritten. The rest are not changed (ex. If both documents have the style “Default Paragraph Style > Heading > Heading 1”, then “Heading 1” will be overwritten. But if the original document has “Heading_1” instead of “Heading 1” it would not be overwritten).

  3. If the original file is a .doc or .docx, there’s a chance that NONE of the styles will be overwritten (this is true even if you save the .doc/docx as an odt BEFORE importing).

  4. It seems that style related to fonts (fonts, size, line height, color, etc.) are especially problematic, as are any styles related to lists / bullets and paragraph spacing.

  5. The ONLY TIME that styles seem to be imported and overwritten properly with any regularity is if both documents were originally created with LibreOffice, they are both .odt files and they both have the exact same style names and structure. But even this does not work 100% of the time. There are still times when all styles are not overwritten.

The primary issue seems to be with overwriting the styles, not importing them. It’s also a shame that it works terribly with doc/docx files, as that is one of the primary reasons documents appear to formatted incorrectly in LibreOffice to begin with and attempting to import styles is a common solution.

Also, I understand that one solution would be to manually apply all the styles and/or to edit the existing styles. But that defeats the purpose of importing them and doesn’t change the fact that the import function does not work properly.

First this is not a solution to the initial question. You should have asked your own question since you provide more information than OP, of course adding a link to this one.

Regarding importing styles from .doc(x) documents (point 3) this is doomed to fail because, despite the “quality” of the DOC import filter, both suites have different founding principles; their “descriptions” for styles are different and this calls for interpretation when conversion occurs. Word has only a notion for paragraph styles and no equivalence for character, frame, page and list styles. Consequently, trying to import the latter categories does not make sense because they don’t exist in DOC.

Generally speaking, if your documents are plagued with direct formatting (both in source and destination documents), don’t expect success. Import will transfer the style definitions, not the direct formatting layer. You get what you expect only if you don’t hide the effect of styles with direct formatting (direct formatting always takes precedence over styles).
You didn’t tell us how you compose your documents. Do you follow a strict styling procedure? If you tolerate direct formatting, you’ll always meet formatting surprises.

(point 2) Heading_1 and Heading 1 are effectively different styles. LO respects your design decision and will not merge them on its own.

(point 4) List formatting will be correctly imported if if is based on list styles. If your lists depend on Format>Bullets & Numbering (or their toolbar equivalent), failure is guaranteed because this is a courtesy convenience feature aimed at easing conversion from M$ Word. Since it addresses separate indistinct lists where modifying one should not alter another one, it doesn’t behave like styles but like direct formatting.
I never had any problem with fonts, but I stick to a style-only formatting.

(point 5) Exactly. But same structure is not a requirement.
In which circumstances did you experience failure? Was direct formatting also in effect?

A more versatile and powerful method is to base your documents on templates. You no longer need to import styles. You automatically use those of the template. In addition, when you modify styles in the template, the documents are automatically updated if you accept the changes.
But once again, direct formatting is your enemy.

2 Likes

@Frank_G
One more request, if you address participants here directly, please it would be nice if you write their name correctly and use it correctly.
The easiest way to achieve this is to put an @-sign. Then you will be shown a small list of the participants in the question. Example:

example participants

My suggestion refers to your first sentence, it should read: “First, @mikekaganski , …”


And I’m sure you noticed that the initial question was more than 1 1/2 years ago.

1 Like

Hello @ajlittoz,

First, I apologize for posting my comment as a “Solution” rather than posting my own question. My mistake. I’ll be sure not to do that in the future.

Second, thank you for explaining all of that. Reading the explanation does alleviate some of the frustration.

To answer your questions about how I compose documents and what documents I experience problems with: it depends. For my own personal documents, there is rarely an issue, because I rely on templates and rarely use direct formatting.

The issue comes when I work with documents from other people, which is part of my day job. The odd part is, those people are usually using LibreOffice and the templates I’ve created. Though I suppose they could also be using direct formatting – though I know they are not changing specific things like line height and space above/beneath paragraphs (I’ve talked to them about this). My clients often send M$ Word documents and I expect issues with this. I think most clients are only using direct formatting.

Anyway, I really appreciate your patience and explanation. Thank you.

Hello @Hrbrgr,

I apologize for this. I’ll be sure to address participants correctly in the future. I’ve removed my initial comment directed at the initial responder (MK).

I am aware that the question is over a year old. But it is still an issue I experience, which is why I commented.

Thank you for your time.