Convert Scrivener text styles to OpenOffice Heading styles

If you want to edit a compiled Scrivener draft in OpenOffice Writer, it’s often helpful to be able to convert the various section titles of the Scrivener system (folder titles, text file names etc) into the heading system of Writer (Heading 1, Heading 2 etc). Apart from the obvious advantage of being able to easily re-format those heading styles in Writer if needed, the Navigator Panel in Writer builds its section list based on heading level. Using Navigator you can easily move between locations in a large document, and shuffle the order of sections, much like navigating/re-ordering content in Scrivener.

You can of course set up folder titles, text file names etc to have different formatting styles in Scrivener, and these styles will be retained in the compiled Writer document. And you could then manually go through the document and set each title to the heading style you want, but in a large document that can be tedious. There is no native capacity in Writer to batch convert, say, all 18pt, Bold formatted text into Heading 1 style.

But this functionality can be introduced into Writer by a free Writer add-on called Macro AltSearch. This adds an extra Find/Replace Dialog option (Alt Find&Replace) to Writer’s “Edit” menu list.

Here’s how to do the conversion

Step 1: Open up your previously compiled Writer doc, and also open the Alt Find&Replace dialog. Put your cursor on, say, a Chapter Heading in the doc, and then in the Search dialog of Alt Find&Replace, select the “Properties” list, and select the last item on that list, “Same format of characters (based on cursor)”

Step 2: Now click on “Find all” and hopefully the count will match the number of chapters (we will consider what happens later if it does not).

Step 3: Now in the Replace box type: \P{Heading 1} and select “Replace all”

This should reformat all the Chapter Headings to have the Heading 1 attributes.

Repeat as desired: Now, to do, say, Chapter Subheadings, repeat the process, but of course at the “Replace All” step you will type: \P{Heading 2}

What if the “Find all” step doesn’t return the expected results?

Step 2 above may yield more finds than you expected. This can occur because it may not detect all the formatting differences that distinguish the text in Writer. For example, small differences in Font Size between headings and sub-headings may not be sufficient to register. You might need to experiment with the heading formatting you set up in Scrivener’s Compile Draft menu.

On the other hand, if the count seems close to right, even if the “Find all” count may seem wrong, when you do the “Replace All” step the result can often be correct.

The easiest way to check that you are getting the desired result is to have the Navigator Panel of Writer open when you do the “Replace All” step. All Headings will be visible near the top of that Panel.

There are lots of other possibilities with Macro AltSearch that may be of use in other Scrivener-to-Writer scenarios. It seems to have an extraordinary range of options!