Writer : The styles could not alter the paragraph font

There is a very annoying fact I notice in LibreOffice.

I sometimes paste plain text found on internet in my documents.

I always clean it using ‘Clear Direct Formatting’ feature because I hate alien markups in a document.

However the font specified in my styles e.g ‘Liberation Sans’ could not override the font of the pasted paragraph e.g. DejaVu Sans Mono, no matter what kind of clean up I try.

It seems like the styles keep track of everything except the font face.

@camendil for me your solution won’t work as the text is already pasted with markup.

@Mark12547 pasting in a notepad app-like doesn’t help either.

@carnendil has explained well what to do. I add a little explanation why this happens. There are two types of text styles, paragraph styles (e.g <h3>) and character styles (e.g <em>). And there also are “local style changes” or “Direct formatting” (e.g <span styles=""> element). While pressing Ctrl+M to clear direct formatting all these <span> style changes are removed, but others are intact. If you had applied these character styles yourself you would find this to be a good thing.

To get better understanding of what is going on, you could do a small test.

  1. Open three documents
  2. In first document write something with strong emphasis (use character style with this name from Styles and Formatting dialog with F11)
  3. Change your style in first document and make text with strong emphasis also red, select your text and copy it.
  4. Paste it second and third document.

See that in second document, where we already had used this style it was already defined, so pasted text stayed black. In third blank document the style get’s created while pasting, it inherits settings from pasted text and turns out red as the original.

See also → Clear Direct Formatting Problem

Try pasting without format: Edit | Paste special and select Unformatted text.

Alternatively, the Special paste window can be launched with Ctrl+Shift+V.

Click for full-resolution image.

Finally, you can click the triangle to the right of the Paste icon or click the Paste icon without releasing the left mouse button.

(image from open-of-course.org’s course on Writer)

Please note that my system is in Spanish, so the actual text of the menus and options might be different.

I frequently copy text from an email or a web page into a document, and “Paste Special” (or Ctrl+Shift+V) and picking “Unformatted text” has always worked for me. It also saves from me having to select a region and in the Style box select “Clear formatting”.

In days before I was using LibreOffice or even OpenOffice, I would have to paste into Notepad (or other purely ASCII editor), then copy from Notepad to the desired document. I’m glad I don’t have to do that copy/paste/copy/paste dance anymore!