Libre-Office Writer Pasting with source formatting

I try to paste my code in my libre office writer document with source formatting, that means I want the blue lines in my code to stay blue, italic to stay italic etc…

Sometimes this works automatically. Other times, the Document arbitrarily decides that it will convert source formatting to document’s format, so everything is pasted as plain text.

I am trying to find a solution but cannot, also my paste special option seems to be grayed out. This shouldn’t be this difficult and time-consuming.

[edit: removed redundant tag]

Hi Gravity

There is a bug hidden within all this somewhere, although I’m not certain precisely where it is.

Mine is LO-4.4.3.2 under Debian 6.0.

A quick refresher:-

Copy (Ctrl-C or Ctrl-Insert) copies text (plus more) to the Clipboard.

Paste (Ctrl-V or Shift-Insert) pastes clipboard text at the cursor

The above is true within a text/plain editor but can vary in a GUI editor such as LO-Writer. That is because the copy process often puts much more than just text/plain text into the Clipboard. It can also add a whole menagerie of other MIME artists (such as text/rtf, and so on). Those can be accessed individually by using Paste Special..., though the options then available depend both on how they were first placed within the Clipboard plus the compatibility of LO-Writer with the OS.

From experience, the Writer default is to copy to the clipboard:-

  1. LO-Writer special-format (default on paste)
  2. text/rtf
  3. text/html
  4. text/plain
  5. DDE link

In general this has worked faultlessly for me. With one exception (and it does vary): …

Paste Special... is a particular bugbear. I’ve been able to establish that when Copy puts only plain-text in the clipboard then Paste Special… will be greyed-out. That is obviously dependant on the source, but even some source-html will result in text/plain on copy back in writer. I do not know Debian well enough to know the defaults for clipboard copy from html.code element.