Why does copying from LibreOffice include unwanted html

I just switched to using LibreOffice writer for my WordPress posts. My MS Word program stopped working with a Windows 10 update last April.

I just copied the majority of my latest post into WordPress and I noticed a ton of html that shouldn’t be there. LibreOffice is adding span tags with style=”font-family:” and lang=”en-US. I’m also getting paragraph tags with class=”western” which is a class in my heading tags as well. Plus style=”color” for my links. I mean every time I hit enter for a new line I get a new paragraph tag.

I probably have to paste everything into notepad or something similar to strip out all this stuff. Does anyone know why this is happening? Is there custom settings to get rid of that? I’m going to lose a lot of time doing find-and-replace on all of that.

Unless you are exporting from Writer as HTML/XHTML, I doubt that Writer is adding this bloated code.

Are you simply copying and pasting from Writer to WordPress? Would it be simpler to enter your text into WordPress straight away? I thought that was what WP was for.

@ve3oat I see the same when copy/pasting from Writer to WordPress so yes, Writer is adding all that bloated code for no apparent reason. @kernix please fill a bug report detailing your experience and then let us know the bug number.

Thanks, @RGB-es An interesting problem. I wonder if Writer does it with apps other than WordPress.

I found a link for the same issue pasting text from a Google dog to WP and it removed all the span and p tags and other html - I’m going to try the same method but for the libre doc. Here is the link if anyone wants to see the method: Google Docs to WordPress — 6 Tricks You Need to Know

Why does copying from LibreOffice include unwanted html

Well - possibly just because its HTML export is less than ideal… :slight_smile: - or maybe because WP has some heavy optimizations for Word-generated HTML, which don’t work with LO-generated HTML.

I’m not exporting - I select - copy, then paste

:slight_smile: So what? LibreOffice needs to put HTML of the selection to clipboard; to do that, it needs to generate the HTML from its own data, which is exporting.

ok - I’m used to File > Export for various programs - didn’t know that is what you meant

Yes, simply copying & pasting. The way most people use WP is to do the majority of the writing in a doc then copy it in. There is too much much work to do for lengthy posts to stay in the editor that long. Why would I want to export as html? I was using WPS writing and not having any problem but that program was locking up and slowing down my laptop.