Invisible Formatting When Copying from Writer and Pasting to G-Docs

Switched to LO from Word earlier this year and for the most part have had little trouble, but this issue has been a constant (if minor) annoyance I haven’t been able to figure out, and I’m just in a mood this morning to see if y’all can help me with it.

After I’ve finished writing for the day, I copy and paste my text from Writer to a Google Doc so that my early readers can have a look at what’s been done for the day. I’ve noticed that whenever I paste anything from Writer, even if its a few words from the middle of a paragraph to correct existing text in the G-Doc, when it lands in the G-Doc it contains extra formatting that shouldn’t be there. Specifically, when I copy the text back from the G-Doc to Writer with the formatting marks on, I have:

TAB SPACE TAB RETURN
TAB SPACE TAB RETURN
actual copied text RETURN

Granted, not the most egregious thing to deal with, but I’m wondering, where is this coming from? It’s doing it with any docs I’ve tried, both odt and docx, and the extra formatting doesn’t appear when either pasting into the basic text editor or when using Ctrl+Shift+V (which isn’t always possible as I’ll often have multiple sections of text italicized for internal thoughts or other emphasis).

Hello @urbanversewrites,
I tested to paste some text from Writer into Google Documents and back into Writer with nothing extrange.
My first guess is that there is hidden Word formatting in your source document.
If do you share a reduced sample doc, we can take a look at it.

Click Tools > AutoCorrect > AutoCorrect Options > Options and untick the following boxes

  • Delete spaces and tabs at beginning and end of paragraph
  • Delete spaces and tabs at beginning and end of line

OK

Here’s part of a one of my documents that I’ve just copied over from the original. This was a new doc, created in odt format, and hadn’t had anything copied from any prior doc/docx sources. Confirmed that I still get the ghost characters when copying text from the sample to G-Docs.
sample.odt (31.8 KB)

I tried this, but noticed no changes in my copy/paste behavior. I even restarted Writer and I’m still getting the mysterious formatting.

I can reproduce.
It may be a mismanagement of the clipboard content by Google Docs. I tested to paste in a Gmail draft, then copy from there to Google Docs; this works better; anyway, there are manual line breaks added to the text.

Version: 25.8.7.3 (X86_64)

Build ID: 30742500f2d3eb4366ac312fa33d3dcabdb3eba5
CPU threads: 4; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win
Locale: es-MX (es_ES); UI: en-US
Calc: CL threaded

The problem is caused by empty paragraphs.
Try to avoid using them; you can adjust the spacing between paragraphs using styles.
I discussed this with Google AI (a Google Docs expert :slight_smile: ), and it turns out that the duplication of empty paragraphs happens when importing HTML-formatted content from the clipboard.

How to fix duplicate blank lines when pasting from LibreOffice Writer to Google Docs (via CF_HTML)

When you copy text from LibreOffice Writer and paste it into Google Docs, paragraphs with manual line breaks (Enter) are exported to the Windows clipboard as <p><br/></p> containers. Google Docs often interprets these as duplicate empty paragraphs, doubling your vertical spacing.

Standard search for \n\n fails because these are not text line breaks, but empty structural containers.

To safely remove the extra blank lines without breaking your heading styles (H1-H3), bold text, or italics, use the following Regex Find & Replace trick directly in Google Docs:

  1. Press Ctrl + H to open the Find and replace dialog.
  2. In the Find field, enter:
    ^\s*\v
    
  3. Leave the Replace with field completely empty.
  4. Check the box for “Match using regular expressions”.
  5. Click Find to test it on the first occurrence, then click Replace all.

How it works:

The ^\s*\v pattern precisely targets only the phantom paragraphs containing vertical whitespace/break characters generated by LibreOffice, while leaving your actual text paragraphs and heading structures completely untouched.

I think that no, because I copied text from the middle of a paragraph in Writer and pasted it in the middle of a paragraph in Google Docs.
image

image

\s Match a white space character. White space is defined as [\t\n\f\r\p{Z}].

\v Match a new line character. The new line characters are \u000a, \u000b, \u000c, \u000d, \u0085, \u2028, \u2029. Does not match the new line sequence CR LF.
(Regular Expressions | ICU Documentation)

Hello, @LeroyG !
I think we conducted different experiments.
I copied the entire content of the document to the clipboard and then pasted it into a new Google Docs document. This resulted in increased spacing between paragraphs.
The recommendation regarding text replacement applies to Google Docs, not Writer. It might help minimize the issue.

1 Like

Here are the results of additional experiments.
In an arbitrary Writer document, select the word And located within a paragraph (the paragraph contains other words as well) and copy it to the clipboard. Then, paste it into a paragraph in a Google Docs document.
Perform the same test with an MS Word document.

Google AI:

Further experiments reveal a deeper architectural issue with how LibreOffice Writer generates CF_HTML compared to Microsoft Word.

The Problem:

If you select just a single word or phrase within a paragraph in LibreOffice Writer and paste it into the middle of a sentence in Google Docs using Ctrl + V, the target sentence gets split into three separate paragraphs.

Why this happens (Under the hood):

Even for a single-word selection, LibreOffice Writer always wraps the clipboard payload in a block-level paragraph tag:

<p lang="en-US" style="...">And</p>

When Google Docs parses this HTML, it sees the <p> tag and treats it as a command to break the existing paragraph and insert a new block.

How MS Word handles this differently:

Microsoft Word is context-aware. If you select a single word inside a paragraph, Word exports it to the clipboard as an inline <span> element (without the <p> wrapper):

<!--StartFragment--><span lang=EN-US style="...">And</span><!--EndFragment-->

Because it is an inline element, Google Docs pastes it perfectly inside the sentence without splitting the paragraph.

Workaround for LibreOffice users:

  • For plain text: Use Ctrl + Shift + V to bypass the HTML wrapper completely.
  • For formatted text (bold/italics): You will have to paste via Ctrl + V and then press Delete twice to re-join the fragmented paragraphs, or open an issue on the LibreOffice tracker to request context-aware CF_HTML generation (similar to MS Word).
3 Likes

Well, that sounds like a very reasonable explanation of the issue. Much appreciated!