Writer: Automatically generate and apply styles?

I have several long documents, where the same formatting is used throughout, but Paragraph styles have not been used.

Example: On every page, there is a heading in Bold, font size 24. There is a subheading in Bold, font size 12. etc

Is there any way to automatically generate and apply styles.

E.g. I could press a button and all the text that is Bold, Font size 24, will be saved as one style (and that style will be applied to all the text that is Bold, Font size 24)
All the text that is Bold, font size 12, will be saved as another style (and again that style will be applied to all the text that is Bold, Font size 12)

I know I can use “Find & Replace” to find all text that has certain attributes and then apply a style to it. But that involves a lot of clicking. If there was a way to automatically generate and apply styles, it would be easier.

If it’s not possible with the built-in tools, is there any extension that can do this? I have searched but not found one.

Environment: Libre Office Version: 6.2.5.2 On Mac OS X 10.14.5

If your document is rather consistent, i.e. the exact same decoration for the same use everywhere, you can partly do it but it remains a tedious manual task.

I assume that the set of built-in paragraph styles satisfies your need: the names of the built-in styles are meaningful for your paragraphs, like Text Body for common text, the various Heading n for your headings, Footnote for your footnotes, etc.

  • List the categories of your paragraphs (body text, list with such and such properties, headings, header, etc.) and try to match these to built-in style names. If some categories do not find a corresponding counterpart in the built-in styles, create a new style by right-clicking on the closest-match one in the style side pane (F11 but for Mac – already preempted by the OS, so use Styles>Manage Styles) and New. Give it a name in Organizer tab and don’t bother for the settings.

  • Duplicate one of the paragraphs you are interested in. Give the copy the target style (double-click on name in style list while cursor is in the paragraph). Formatting changes but this is not important.

  • Select the original instance and Format>Clone Formatting. Swipe the cloning tool over the copy. Formatting is transferred.

  • Put cursor in the copy and Styles>Update Styles to update the style definition. Check and delete the copy.

  • Proceed with Edit>Find & Replace as you know. Find All and quit Find & Replace. The highlighted text remains selected. Apply the style.

    *From experimenting, it looks that manual formatting on individual words is kept, the paragraph style being applied to non-decorated sequences.

Repeat for every style. This is very manual, but a well-designed document has rarely more than 20 active paragraph styles. This should be manageable.

I didn’t find any similar procedure for character styles. Consequently, you must hunt for every occurrence. There is no method to find sequences which attributes defer from paragraph base formatting. It is really a burden.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!