Writer smart automatic formatting

Is there a smart way (extension, macro, etc) to apply automatically header paragraph styles to a Writer document where header where manually formatted using bold, indents and numbering for example?

The reason for this is to be able to create a table of contents.

Select the text and do crtl+m or right click and select “clear direct formating”

You will get then the format, which is stored in the related style of the style window. (F11 or the related icon).

To create a table of contents you only need to place the cursor where you want the Table-Of-Contents and go to

insert / index and table / index and table

There you find all concerning the format and layout of the TOC.

Just try the default and later you can make adjustments.

If you need the same format more often I recommend to make a template containing all formats you need.

It is helpful to have a look at:

Defining Index or Table of Contents Entries - LibreOffice Help

Templates and Styles - LibreOffice Help

Styles in Writer - LibreOffice Help

The problem is that Libreoffice uses paragraph styles to set TOC entries. If someone didn’t use paragraph styles to format the document then it seems LO cannot try to “guess”, from manual formatting (bold, italic, font size, indent), what entries to add.