Clean up .odt file?

My question is the same as the topic from '15 by Mike Cowlishaw - which was closed without an answer.
In my case it relates to a document where I was marking certain words with background colours. - Which was increasing the opening time of the document.
After removing these markings from the text- there is still a great deal of style definition left in content.xml.
Is it possible to automatically clean up the document, and if not yet - I would ask you to put this capability into the plans.

Many thanks in advance - Jan Mieszczanek

Please specify for all requests:
Operating system
LibreOffice version (four digits, e.g. 7.4.5.1).
File type in which the file is saved. Thank you.


Edit a copy of your file so that it contains 2-3 pages and any personal data is removed, but the problem you described is still present. Please upload this file here. Thank you.

In addition to @Hrbrgr’s request for information, describe your routine to format your documents. There are two ways to do it: direct formatting, where everything is manually done, and styling where formatting directives are configured exclusively inside styles.

Internally, direct formatting is converted into styling (because this is the fundamental principle in Writer) but, without global knowledge on your ultimate goal, all formatting occurrences, even if identical to preceding ones, are turned into one-shot styles, resulting in a dramatic multiplication of styles. What you see in contents.xml may a a consequence of this.

Thank you, for your quick answer, and this is my answer for you questions:

Version: 7.6.5.2 (X86_64) / LibreOffice Community
Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b
CPU threads: 12; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: pl-PL
Calc: threaded

(I don’t know why LO see W10, I use Windows 11 Home, 23H2).

With previous versions (both LO and Widows) the same phenomenon occurred).

Myślę że sytuacja jest właściwie opisana w następnej odpowiedzi, by ajlittoz

Thank you

Thank you, for your quick answer, and this is my answer for @Hrbrgr questions:

Version: 7.6.5.2 (X86_64) / LibreOffice Community
Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b
CPU threads: 12; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: pl-PL
Calc: threaded
(I don’t know why LO see W10, I use Windows 11 Home, 23H2).

However, I think your answer provides a good diagnosis of the situation, so the above data is irrelevant. (With previous versions of LO and Widows the same phenomenon occurred).

I usually avoid using direct formatting, but this time I was comparing two different translations of the same source. So it was most handy to use direct formatting, so I could easily align and compare the two texts.

The question remains - is it possible (or more appropriately how difficult ) to create a mechanism to remove each one-shot style when the direct formatting of the text to which that style has been assigned is removed. The current solution works, but could be improved.

Thank you