Can Clear Direct Formatting keep the text color and italic/bold?

I have written a book with Text Body incorrectly set to 14 point. So I changed the Text Body style to 12 point and it fixed 95% of the text to the correct 12 point size. Unfortunately I must have overridden the font size for the remaining 5% and it did not revert back to 12 point. Now I’m going through the book using Clear Direct Formatting so it reverts back to the default Text Body but I lose any of the text that was set to Bold or Italic or a different color and the line spacing that I overrode.

Is there an easier way to revert the text back to the current font size without explicitly setting it to 14 point manually because that what got me into the problem to begin with (I might want to go back to 14 pt or even 10pt). I need to retain the italic/bold/color of the text and if I could retain the line spacing that would be good too! I just need to revert the text size back to the default text size for Text Body. TIA

Writer v7.0.4.3 On Win10

That is what Character styles are for, formatting attributes that don’t apply to the whole paragraph. There are some already shown in the character styles sidebar: Emphasis, Strong Emphasis, Source Text, etc. The paragraph style can be changed or direct formatting removed and the attribute is kept. Take care when creating a character style to not specify anything that has to change with paragraph style. If you overwrite your direct formatting with a character style and then remove the direct formatting the font size will change with a change in paragraph style but the attributes of the character style are retained.

To replace your directly formatted Bold text with Strong Emphasis you could press Ctrl+H (Find and Replace), Click in the Find field but leave it blank. Click the Format button and select Bold from the appropriate field, then OK. Press Find All then double-click the Strong Emphasis character style in the Sidebar to apply it to your selection. You could now remove the direct formatting and the words will remain bolded. Note that is a simplistic explanation as you also have italic and other attributes so care and planning is needed.

Click File > Save a copy with a different name before you start so you can go back. I usually add a date or date and time suffix

Line spacing is a function of Paragraph style; if you need a different line spacing for some paragraphs make a paragraph style based on Text Body so that if you change Text Body the other attributes will change too.

4 Likes

In addition to @EarnestAl ,

Professional text composition with Writer

1 Like

EarnestAI,
Thanks for that concise reply. I wish I had known about character styles before I started writing, instead of using Bold, Italic, Red and Blue colors explicitly.

I tried your suggestion of using Ctrl+H to replace the font styles with character styles and it worked! (And yes I have backups!).

The only slight problem is, I was hoping the Character Style could inherit the Font, FontSize from the Text Body paragraph style. So if I change the paragraph style of Text Body to say 10 pt or change to a different font, then the character styles would use the same font information of the new properties of Text Body so they match.

Because the way it sits, if I change Text Body font size or the font name etc., I will have to go into my Character Style and change those too.

Is there any way around this?
TIA

1 Like

Character styles are intended to be usable in any paragraph, independent of its paragraph style. That way, you can use the Emphasis character style in the body text and in headings, because you don’t derive anything from one specific paragraph style. And that’s a good thing.
Warning There is, if I’m correct, one nasty thing about character styles and direct formatting that isn’t always mentioned: if you set for instance a different font size in direct formatting or in a character style, and you later change that back to the “standard” value, it will still count as a form of direct formatting or a font size modification in the character style. In the latter case, if you changed the font size of the Emphasis style from 12 to 10 pt, and later change it back to 12 pt, the 12 pt is now part of the definition of that style, and text in a heading formatted as Emphasis will be in 12 pt, even if the heading is 14 pt by its paragraph style. Therefore, make sure that when you make or modify a character style, you only change or set the properties that the style is meant for and nothing else.

1 Like

Before you start formatting in earnest with styles, you should find out exactly what their effects are and how they interact.
It is also important to understand that inheritance occurs within paragraph and character styles.
If you want to reset a character style formatting, for example, you can do this by assigning the character style “No Character Style”.

See also:

Inheritance in paragraph styles in Writer

2 Likes

@anon87010807’s warning is correct. The shame is that the GUI is bi-state while the attributes in styles are tri-state (at least for on-off attributes represented by a checkbox; it is a little more complicated for “continuous” attributes like font size).

Remember that Writer formatting is built upon a layered model where upper layers hide lower layers and styles form a hierarchical tree (just like a genealogical chart) where descendant styles inherit their attributes from ancestors.

Initially in a fresh new style, all attributes are in “transparent” state, i.e. they show ancestor’s value. This state is not rendered in the GUI. Whenever you change any attribute, it is no longer in “transparent” state but in “overriding” state, i.e. the value overrides the ancestor’s. In the case of a checkbox, if you make up your mind and want to erase a tick, this erasure is also an overriding attribute. Any action on an attribute results in overriding set, whether the attribute is set or cleared.

Taking the example of your 12pt/10pt, clicking a size selects this size in a character style over the paragraph style.

The only way to revert to “transparent” state is to push the Reset to Parent button. Caveat: it will reset all attributes in the tab. So you have to force again those you wanted to keep.

Last word: layer precedence is:

  • paragraph style (bottom layer)
  • character style
  • direct formatting (top layer)


Regarding styles, paragraph and character live in different namespaces. This means that a character style cannot inherit from a paragraph style.

2 Likes

That makes sense. I should only override the properties I need to, and if I don’t change the font name or font size, then it will use the default font name and font size. Gotcha! (That wasn’t obvious to me in my last post)

I found Character Styles in Writer - The Document Foundation Wiki and I am learning more as I go along.

Thanks for the help. I will spend the next few hours creating the Character Styles and some will be derived and modifying the document with Ctrl+H as EarnestAI suggested, after doing another backup of course. It’s going to be a fun day! LOL

1 Like