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.
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.
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.
<p class="P1"> with a matching rule in the style block, using centimetre or millimetre measurements rather than pixels or rem.
<span class="T1"> wrappers around almost every run, with bold and italic expressed as separate classes rather than <strong>/<em>.
Real <ul>/<ol> elements in most exports, but with class attributes and legacy attributes such as type="disc" or start values.
<table> with legacy attributes — border, cellpadding, cellspacing, width in centimetres, and align/valign on cells — rather than CSS.
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>
Copy from Writer, or export to HTML when you need the style block included
Clean in Publish Helper so P1/T1 classes and the embedded style block are removed
Strip legacy table attributes — border, cellpadding, width in centimetres
Check the result outside the editor: unresolved class references leave text unstyled rather than styled wrongly
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.
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.
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.
Writer's own paste-special affects content coming into Writer. For content leaving Writer, the clipboard always carries the HTML flavour.
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.
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.
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.
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.
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.
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.
Yes. The HTML Cleanup feature with 'Remove style tags' enabled strips embedded <style> blocks and their associated class references, leaving only inline content.
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: March 2026