Publish Helper logo

Convert LibreOffice Writer to Clean HTML

LibreOffice Writer emits a style block of auto-generated P1/T1 classes, centimetre measurements and HTML 3.2 table attributes. This page shows the shape of that output and why a missing style block leaves text unstyled rather than styled wrongly.

I

Why LibreOffice Writer HTML Is Messy

Editor:LibreOffice Writer (and OpenOffice Writer, which shares the same HTML filter)

LibreOffice generates HTML with auto-generated class names (P1, P2, T1, T2), embedded <style> blocks with these classes, inline styles using centimeter-based measurements, and legacy HTML attributes like align and valign on table elements.

II

What LibreOffice Output Actually Contains

Style block

A <style> block at the top of the fragment defining auto-generated classes: P1, P2 for paragraphs, T1, T2 for text runs, and sometimes table-specific classes.

Paragraphs

<p class="P1"> with a matching rule in the style block, using centimetre or millimetre measurements rather than pixels or rem.

Text runs

<span class="T1"> wrappers around almost every run, with bold and italic expressed as separate classes rather than <strong>/<em>.

Lists

Real <ul>/<ol> elements in most exports, but with class attributes and legacy attributes such as type="disc" or start values.

Tables

<table> with legacy attributes — border, cellpadding, cellspacing, width in centimetres, and align/valign on cells — rather than CSS.

III

Before & After

LibreOffice Writer Output

<p class="P1"><span class="T1">Introduction</span></p>
<p class="P2"><span class="T2">This is a paragraph with </span><span class="T3">bold text</span><span class="T2"> and </span><span class="T4">italic text</span><span class="T2">.</span></p>

Clean HTML

<h2>Introduction</h2>
<p>This is a paragraph with <strong>bold text</strong> and <em>italic text</em>.</p>
IV

How to Clean LibreOffice Writer HTML

  1. 1.

    Copy from Writer, or export to HTML when you need the style block included

  2. 2.

    Clean in Publish Helper so P1/T1 classes and the embedded style block are removed

  3. 3.

    Strip legacy table attributes — border, cellpadding, width in centimetres

  4. 4.

    Check the result outside the editor: unresolved class references leave text unstyled rather than styled wrongly

V

Where the Paste Comes From

Ctrl/Cmd+C in Writer → paste into a browser editor

Delivers the fragment with its inline class references. If the <style> block is not carried along, the classes resolve to nothing and the text inherits the destination's defaults.

File → Save As → HTML Document (.html)

Writes a full HTML file with the style block embedded in the head, plus a images folder. The class names are generated fresh on each export.

File → Export As → HTML (Export dialog)

Same filter with options for a single file or a folder of assets; you can choose to embed images as data URIs, which inflates the file substantially.

Paste Special → Unformatted text

Writer's own paste-special affects content coming into Writer. For content leaving Writer, the clipboard always carries the HTML flavour.

VI

Troubleshooting — LibreOffice Writer

The pasted text has no styling at all

The destination dropped the <style> block but kept the class references, so P1 and T1 resolve to nothing. Removing the classes makes the markup predictable instead of accidentally unstyled.

Tables are indented or have odd borders

LibreOffice uses legacy table attributes — border, cellpadding, align, valign, width in centimetres. Strip those and let the destination's table CSS handle borders and spacing.

The exported file is enormous

Images embedded as data URIs are the usual cause. Re-export without image embedding, or clean only the text fragment you need.

LibreOffice's HTML filter is one of the oldest in continuous use, and it shows: it writes class-per-paragraph CSS into a style block, keeps legacy table attributes from HTML 3.2, and measures in centimetres. The output is remarkably consistent across platforms, which makes it easy to recognise, and completely non-semantic, which makes it useless as publish-ready markup.

The two-file nature of an export is worth understanding. When you copy from Writer, you get the body fragment; the style block may or may not travel depending on the destination's clipboard handling. When you save as HTML you get both in one file. If the style block arrives but the destination sanitises <style> away, you are left with class references that resolve to nothing — text that looks unstyled rather than styled wrongly, which is the more confusing failure.

VII

Tools for This Workflow

VIII

Frequently Asked Questions

Is LibreOffice's HTML cleaner than Microsoft Word's?

+

It is simpler. There are no XML namespaces, conditional comments or mso- properties. What it does have is an embedded style block and auto-generated class names, so a cleanup pass is still needed — just a shorter one.

Why do the class names change every time I export?

+

The filter generates P1, P2, T1, T2 in document order at export time. They are positional, not meaningful, so two exports of the same document can assign different numbers to the same paragraph.

Is LibreOffice paste better than Word?

+

LibreOffice paste is generally simpler than Word — no XML namespaces or conditional comments. However, it still uses auto-generated class names and embedded style blocks that need cleanup. Publish Helper handles both.

Does Publish Helper remove embedded style blocks?

+

Yes. The HTML Cleanup feature with 'Remove style tags' enabled strips embedded <style> blocks and their associated class references, leaving only inline content.

Can I use Publish Helper on Linux?

+

Absolutely. Publish Helper runs entirely in the browser — it works on Linux, macOS, Windows, ChromeOS, and any device with a modern web browser.

Last updated: May 2026|Built by content editors for content editors|Used by 10,000+ bloggers
Related Tools & Guides

Ready to clean your HTML?

Open Publish Helper

Last updated: March 2026

Changelog

v3.5.02026-11-08
  • NewWarm dark mode — switch it from the header; your choice is remembered
  • ImprovedWith no saved choice, the theme follows your system's light/dark preference from the first frame, without a flash
  • FixThe browser's theme colour now always matches the current theme — one meta tag instead of two
  • FixDark mode rebuilt on the current page architecture, so it applies consistently to every page
  • ImprovedEvery pull request now runs type checks, unit tests and a production build automatically — same features, steadier quality
v3.4.02026-11-05
  • New4 new platform guides — ChatGPT, PDF, beehiiv and Mailchimp
  • ImprovedAll 16 platform guides rewritten with platform-specific content; Keyword Density, Readability and HTML Diff guides expanded ~3×
  • FixAd banners no longer push content down the page — stable layout from first paint
  • FixStructured Data tool's date field no longer stuck at the build date
  • ImprovedMobile: compact cookie banner, larger touch targets, AA-compliant text contrast
  • ImprovedRelated-page links now stay in your language
  • FixInternal fixes — sitemap coverage, canonical URLs, security headers and legacy URL handling
v3.3.12026-06-17
  • FixSlug generator updated to latest AI model for better reliability
  • FixHeading conversion now supports U+FE30 colon separator (︰) used in vertical CJK text
  • FixHeading conversion no longer includes leading &nbsp; in the extracted title
  • FixOG image generator now wraps long CJK text and prevents overflow with ellipsis truncation
  • ImprovedUpdated sharp to 0.35.1 for better image processing
v3.3.02026-05-30
  • FixSEO & a11y: <html lang> attribute, theme-color meta, OG image alt text i18n
  • FixGA scripts properly removed on consent decline
  • FixContent Stats i18n + link count regex fix
  • FixTool page section numbering corrected (all 14 pages)
  • ImprovedSimplified cleanup options — removed 10 checkboxes Tiptap already handles, kept only 4 useful ones
  • ImprovedAuto-clean only triggers on paste, not every content change
v3.2.12026-05-26
  • FixHeading converter now correctly splits paragraphs containing MULTIPLE heading-strong elements
  • FixHeading converter now places extracted headings BEFORE their body paragraph instead of after
  • FixEditor toolbar no longer causes React hydration mismatch on first paint
  • FixMissing @tiptap/extension-drag-handle-react dependency added
v3.2.02026-05-23
  • New6 new SEO content editing tools — Case Converter, Text Extractor, Text Diff Checker, Keyword Density Analyzer, SERP Preview Generator, Readability Checker
  • NewHeading dropdown expanded to H5-H6 (was H1-H4 only)
  • NewTable toolbar — insert/delete rows & columns, merge/split cells, toggle header row
  • NewDrag Handle React — drag and reorder blocks in the editor
  • NewCase Converter — 11 case formats including camelCase, PascalCase, snake_case, kebab-case
  • ImprovedSERP Preview — accurate Google-style preview with desktop/mobile views
  • ImprovedText Diff — word-level highlighting within changed lines
  • ImprovedAll new tools linked from the main page TOOLS & GUIDES section and related pages
  • Improvedzh-TW FAQ alignment fixed across all tools
v3.1.12026-05-23
  • FixEditor draft restore — saved content now correctly loads into the Tiptap editor on page reload
  • ImprovedDependency updates for better performance and stability
v3.1.02026-05-14
  • NewBold List Labels — auto-bold label prefixes (e.g. "Name: John" → "<strong>Name:</strong> John") in list items
  • NewFormatting Add-ons group — Heading Conversion, CJK Auto-Spacing, and Bold List Labels now grouped under a collapsible section
  • FixCJK Auto-Spacing now works across HTML tag boundaries
v3.0.22026-05-08
  • FixHeading converter now correctly splits multiple H2/H3 prefixes inside a single <strong> element separated by <br> tags
v3.0.12026-05-07
  • FixHTML cleaner now properly strips orphaned <strong><br><br></strong> tags left behind by Google Docs
  • FixHeading converter now detects H2/H3 prefixes inside <strong> tags embedded at the end of a paragraph
  • FixTrailing <br> tags at the end of paragraphs are now stripped — no more pointless line breaks before headings
v3.0.02026-05-03
  • NewHTML Diff Viewer — compare before and after HTML with a visual diff (green/red)
  • NewContent Stats Calculator — word count, reading time, heading, image, and link counts
  • NewHTML Accessibility Checker — detect missing alt text, empty headings, skipped levels, and more
  • NewOG Image Generator — create 1200×630 social share images from your blog post title
  • NewMarkdown ↔ HTML Converter — bidirectional conversion between Markdown and HTML
  • NewTable of Contents Generator — auto-generate nested TOC from heading tags in HTML or Markdown
  • NewJSON-LD Structured Data Builder — generate Article, BlogPosting, and FAQPage schema markup
  • NewAuto-clean on paste — optional toggle that auto-triggers cleanup when content is pasted
  • NewTable cleanup options — strip cell widths and remove empty table cells
  • NewAuto-save draft — content is saved to localStorage and restored on accidental refresh
  • NewAll new tools linked from the main page TOOLS & GUIDES section and related pages
v2.4.12026-04-27
  • NewParagraph option added to heading dropdown — convert headings back to normal text
  • FixH1–H6 heading prefixes now convert correctly even when pasted with leading line breaks
  • FixFixed page crash on load — cookie consent now renders reliably
  • ImprovedDependency updates for better performance and stability
v2.4.02026-04-17
  • NewClear button — quickly wipe all editor content and reset the HTML panel from the left panel header
  • FixEmpty <p></p> placeholder no longer appears in the HTML panel after clearing the editor
  • NewImage insert via URL — paste any image URL into the editor with a new toolbar popover
v2.3.22026-04-14
  • FixHeading conversion rewritten with DOM parsing — now works with any wrapper tag, split headings, and safely preserves <li> inside lists
  • FixEmpty heading tags left behind by Google Docs are now automatically removed
v2.3.12026-03-25
  • FixHeading conversion now handles spaces before the colon (e.g. "H2 : Title")
  • FixRight-to-left content (Arabic, Hebrew) no longer inverts embedded English text in the editor
  • FixSpacer paragraphs (&nbsp;) are now preserved in the HTML output instead of being stripped
v2.3.02026-03-20
  • NewCJK auto-spacing — automatically insert spaces between CJK characters and English letters or numbers (powered by pangu.js)
  • NewStandalone CJK Auto-Spacing tool page with before/after examples, FAQ, and SEO-optimized bilingual content
  • NewChinese UI text auto-spacing — zh-TW interface text now has proper CJK–Latin spacing
  • FixMobile toolbar no longer floats and follows scrolling — stays pinned at the bottom of the editor
  • FixMobile toolbar buttons now scroll horizontally instead of overflowing
  • FixFind & Replace inputs no longer break out of the container on narrow screens
v2.2.12026-03-20
  • FixHeading conversion now uses the text prefix (e.g. H3:) to set the heading level, even when the content is already inside a different heading tag
v2.2.02026-03-18
  • NewAI-Powered Title to SEO Slug — Convert blog titles in any language to SEO-friendly English slugs in under 10 seconds
  • NewSlug generator toggle on the main page — generate slugs right after editing, above the fold
  • NewTable support — pasted tables from Google Docs now render correctly
  • NewRemove <br> after headings cleanup option (on by default)
  • NewPartial text selection copy in the HTML code view
  • NewSticky Clean HTML button at the bottom of the page
  • ImprovedHeading conversion now strips prefixes from existing heading tags and supports Chinese full-width colon (:)
  • ImprovedShared footer across all pages
v2.1.22026-03-17
  • FixBug fixes and improvements
v2.1.12026-03-16
  • FixBug fixes and improvements
v2.1.02026-03-16
  • NewFormatted/Raw toggle for the HTML code view
  • ImprovedCopying from the code panel now always gives clean, unformatted HTML
v2.0.02026-03-16
  • NewWelcome to Publish Helper — free online tools for content editors
  • ImprovedImproved search engine visibility
v1.1.02026-03-16
  • ImprovedClipboard copy — clean HTML output matches the code view
v1.0.02026-03-16
  • NewRich text editor with Google Docs paste support
  • NewHTML cleanup: strip styles, classes, empty tags, and Google Docs artifacts
  • NewHeading conversion from text prefixes to proper HTML tags
  • NewFind & replace with regex support and saveable presets
  • NewSyntax-highlighted HTML preview with one-click copy