How to export Outline documents in-tact without ruining numbering

Hello. I’m writing a complex science document and I’m using the Outline numbering system. As expected numbering looks like this in Writer:
1.
1.1.
1.2.
1.2.1
2.
2.1
2.1.1
2.1.2.
3
4
4.1
etc…

I’ve tried all kinds of exports but they all strip the complex Writer outline and replace it with HTML ordered lists which do not use the multi-level outline format. The only thing that retains the outline numbering system is the text file format, but that strips all the rich text formatting.

Is there some way to export to simple HTML while retaining the Outline multi-level numbering structure? Ultimately this export will be copied/pasting into a Wordpress rich text object.

Could you give more technical details? First LO version and OS name.
Here 7.2.2.2 under Fedora 35 (Linux) and File>Save As then choosing HTML works as expected. Outline is saved as <h1>, <h2>, …


I start with an “ordinary” Writer document (.odt). I don’t create an HTML document from start (File>New>HTML document`) because it won’t number the outline multi-level (1.2 is rendered as 2 and 1.2.3 as 3). But it is still <h1>, <h2>, …

Describe precisely your procedure.

Sounds like a WordPress question. Here is a WordPress answer Styling Ordered Lists with Letters in WordPress – Roger Williams Media

It’s not a wordpress question… Writer is not outputting the Outline numbering format in several structured file formats, probably because they are unsupported (e.g. HTML). It could output the Outline numbering format but it seems that Writer is attempting to convert to the destination format’s native numbering system. In the case of HTML, it only does ordered lists

Thank you for responding.
What you describe is what I get. Although it may be outputting as H1, H2, etc., it is converting to the native numbering format of HTML, which has no levels. I need it to fully retain the entire level structure. I don’t think it’s a bug in Writer but rather an intentional design choice. Unfortunately the only way to retain the full numbering is by exporting to a flat text file, which strips of formatting like colors, bold, italics, underline, etc.

You can easily reproduce it by creating a new ODT file. Create a bunch of entries using the outline numbering format. Then export to HTML or RTF or similar. It strips down the full numbering format to a 1 level format, which is not useful for legal referencing.

Windows 10 build 19043
LO v7.2.2.2. (x64)

I wasn’t perhaps clear enough. I worked with an .odt document where the standard multi-level chapter numbering works perfectly. I save this document as .odt to keep a clean reference.

I don’t export it (as File>Export) because it doesn’t offer HTML choice, only PDF and ePUB. I use File>Save a Copy and HTML format. When this copy is opened in a web browser, the multi-level numbering is displayed as expected.
There is however a “glitch”: I can’t get any space between the number and the first word of the heading. Perhaps, you’ll be luckier than me.


Here’s what it’s doing for me when I do File → Save Copy As… → .html
It’s not retaining the full numbering like “10.3.1.5.”.

Attach a sample file so that I can have a look at your chapter numbering properties

list test.odt (14.7 KB)

It wouldn’t let me attach the .html file but here’s its code. As you can see, it simply reduces it to simple ordered lists without retaining the outline nested numbering format (the full thing).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=windows-1252"/>
	<title></title>
	<meta name="generator" content="LibreOffice 7.2.2.2 (Windows)"/>
	<meta name="created" content="2021-11-21T13:08:13.301000000"/>
	<meta name="changed" content="2021-11-21T13:10:11.730000000"/>
	<style type="text/css">
		@page { size: 8.5in 11in; margin: 0.79in }
		p { line-height: 115%; margin-bottom: 0.1in; background: transparent }
		h1 { margin-bottom: 0.08in; background: transparent; page-break-after: avoid }
		h1.western { font-family: "Liberation Sans", sans-serif; font-size: 18pt; font-weight: bold }
		h1.cjk { font-family: "Microsoft YaHei"; font-size: 18pt; font-weight: bold }
		h1.ctl { font-family: "Lucida Sans"; font-size: 18pt; font-weight: bold }
	</style>
</head>
<body lang="en-US" link="#000080" vlink="#800000" dir="ltr"><h1 class="western" style="page-break-before: always">
1U<font face="Liberation Sans, sans-serif"><font size="5" style="font-size: 18pt"><b>adad</b></font></font>ed
Meadasddical<font face="Liberation Sans, sans-serif"><font size="5" style="font-size: 18pt"><b>a</b></font></font>P
roadadacedures</h1>
<ol>
	<ol>
		<li><p style="line-height: 100%; margin-bottom: 0in">No psdgfsdfgg
		m sd s gfsd fg dfsg sd gd sfg dfsg sdgf dsgf.</p>
		<li><p style="line-height: 100%; margin-bottom: 0in">Thsdfg g s dg
		sdfg sdfg sdf gs df fdg sdfg sdf gf sdgut:</p>
		<ol>
			<li><p style="line-height: 100%; margin-bottom: 0in">Jwjefwjfw,</p>
			<li><p style="line-height: 100%; margin-bottom: 0in">asijdf
			oajfoasdjf s,</p>
			<li><p style="line-height: 100%; margin-bottom: 0in">pasijd
			fijlsdf asdf j,</p>
			<li><p style="line-height: 100%; margin-bottom: 0in">Cha sg sdg 
			sdfg dsg sdfgies</p>
			<li><p style="line-height: 100%; margin-bottom: 0in"><font face="Source Serif Pro, serif">sg
			sdg sdfg</font>.</p>
		</ol>
		<li><p style="line-height: 100%; margin-bottom: 0in"><b>Customer.</b>
		 <font face="Source Serif Pro, serif">s dfg dfsg dsfg ds gs dfg sdf
		sdfg sdf gemroweoropwekfpme</font>.</p>
		<li><p style="line-height: 100%; margin-bottom: 0in"><b>Government.
		 </b><span style="font-weight: normal">e wjeroiweri  ew klfsdklfasd
		fasd jfsj fasj</span><b> </b>.</p>
		<li><p style="line-height: 100%; margin-bottom: 0in"><b>Exceptions.
		 </b><b> </b><span style="font-weight: normal">lasjfl asjfl ajsflk
		jasdlkjadslk fjasdlk;j fl jfla jaf jiowj efop weiofuweiourfipwe
		qiouqwiuriweu</span><span style="font-weight: normal">.</span></p>
		<li><p style="line-height: 100%; margin-bottom: 0in"><b>Testing</b><span style="font-weight: normal">.
		 </span><span style="font-weight: normal">kJAODJAIDJ JFAJJjojiosj
		fioasjfjasdjf adsfiopasu fawiof wiaiufp asfu iasudfasd fawf ioasu
		fiasdhfiadsh fashioh fgweioa hfw qif jwefjiawjfiwaej fipweajfp[weaj
		ipfwea </span><span style="font-weight: normal">.</span></p>
	</ol>
</ol>
</body>
</html>

Using your odt, both MS Word and Google Docs can export an HTML document with outline numbering similar to yours (Google docs needs your numbering to be redone so it begins with 1). Word makes a much larger file size html document than Docs.
The point is that both can do it. It might be worth filing an enhancement request, see How to Report Bugs in LibreOffice - The Document Foundation Wiki.

You are the culprit.

Your .odt document is not correctly structured: you used only Heading 1 for level 1. All other items are styled Default Paragraph Style with manually-added list numbering.

To fix your document, style your level 2 items with Heading 2 and level 3 with Heading 3. It is likely you wouldn’t like the default look of these levels. Just customise the built-in styles to your liking.

There will be other “glitches” due to HTML conversion. One of these is indentation. In “normal” documents you tune it with Tools>Chapter Numbering. It does not work in HTML export. Contrary to standard procedure, you’ll have to set your indents in each Heading n.

Important advice: never use Default Paragraph Style for any text in your document. This special style is the ancestor of all others. This means any modification you make on it is automatically forwarded to all others. It is intended to define defaults (hence its name) shared over all styles. Consequently, it is really a bad idea to customise it for your bulk text as it will have side effects on all others. The style intended for bulk text is Text Body.

This is in contrast with M$ Word where Default Style is the normal style for text.

Second advice: avoid direct formatting. At first sight, it looks easier to use it to format your document but it results in real nightmare when you want to tune document appearance. It also complicates document maintenance. Learn styles, not only paragraph but also character and page styles (for a start). Then format your document exclusively with styles.

I started from scratch. Used Ctrl+1 to Ctrl+4 to set Heading 1 to Heading 4 styles.
When I try to set the Outline level modifying Heading 1 style, I get:


So, I choosed Numbering 123 from List Styles, then edited the style to choose Numeric with all sublevels Outline (1, 1.1, 1.1.1, etc.).
This worked in Writer, but not exporting as XHTML.

I don’t understand your point using Numbering 123. There no need to change the internal reserved chapter numbering. What you set in a list style is set through Tools>Chapter Numbering which accesses the reserved style settings. And then it exports to HTML.

2 Likes

Got it. I’m still learning. Thanks.
chapter numbering 4 levels

To clarify, are you saying that every line of the document has to be a Heading 1 - Heading 9? In pseudo-code, you’re saying it should look like:

<H1><1.0>Blah Blah Blah</1.0></H1>
     <H2><1.1>Chicken soup is delicious when you're sick and it should be made from the following ingredients: </1.1></H2>
          <H3><1.1.1>Chicken</1.1.1.></H3>
          <H3><1.1.2.>Broth and broth concentrate</1.1.2.></H3>
     <h2><1.2.>Cooking instructions for stove tops</1.2.></H2>
           <H3><1.2.1.>Full heat</1.2.1.></H3>

It just seems counterintuitive for me to use Headings for anything other than headings. My content may or may not have actual headings, but is instead mostly nested sentences/paragraphs.

Okay, so each line in the example below would have a heading style assigned to it? So the entire document would be a Heading of some level?

[H1] 21 Medical Information Technology
[H2] 21.1. Helpdesks for Medical Information Systems
[H3] 21.1.1. Any government medical data collection system shall offer a full time help desk function adequately staffed to allow a healthcare practitioner or their designated representative to reach a human agent in 5 minutes of less. Others shall have a wait time to reach a human agent not in excess of 10 minutes.
[H4] 21.1.1.1. The helpdesk shall make public monthly reports detailing all call volume data, including wait times.
[H4] 21.1.1.2. Staffing shall be modified based on monthly historical data and by agency forecasts of demand.
[H2] 21.2. Public Accessibility of Data
[H3] 21.2.1. The following requirements apply to all government information systems:
[H4] 21.2.1.1. Shall have a public interface to internal systems.
[H4] 21.2.1.2. Shall offer downloadable structured data of any database contents.

Your question was how to get the numbers exported to .html. One possible answer is: Use the numbering for headings, wich already is exported right.

If you stay within LibreOffice you obviously have other options.