Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Character styles are attributes of a <text:span> element (similar to HTML). From point of file format there is no problem. It is explicitly mentioned, that <text:span> elements may be nested.

If you apply a character style, then the marked part is put into a text:span element with the double-clicked style. If it has already been inside a text:span element, then the part before and the part after are both put into own text:span element with the old character style.

If you hold shift-key down while double-click, the strong-emphasis-style is added to the old style. So not only one text:span element is generated, but two, which are nested. The outer one gets the old style and the inner one gets the strong-emphasis-style. You must first select the style, then press shift (and hold) and then double-click. First shift and then select style will not work.

From point of style-format it is not needed to divide the text in "before", "styled", and "after" parts; and I dislike it. It produces very fragmented source. What makes it worse it the fact, that LibreOffice inserts additional automatic styles without need and does not join adjacent equal styled parts in case you remove or reassign styles.

Your code examples are likely not inline but in separate lines. In that case I would not use character style to set them in monospaced font, but would use a paragraph style for that purpose. Doing that, the strong-emphasis-style is the only character style and is written with a simple single text:span element.

The current behavior is not new. I see it already in OOo3.2.