In a previous post I provided code for a simple macro I wrote to export text from an Office Writer document that was suitable to paste in the non-visual WordPress editor. The reason I wrote this was to produce the minimal HTML necessary without cluttering the resulting document. Occasionally I write in Writer and then decide to post the result to one of my WordPress blogs, and this makes it more convenient.
I’ve updated this macro to correctly export links and various levels of headers. It still has the rather obnoxious code to convert outlines, which you will probably not want to use. It does not convert either ordered or unordered lists.
I had thought to make a way for the document to be saved to the same filename as the source, except with an HTML extension, but for my own purposes, it works better to use a single file. Obviously you will need to change that name. I simply keep the file loaded in jEdit, and update it, thus giving me an easy way to copy and transfer.
Update (12/4/07): I have fixed my stupid error in including this file inside PRE tags. It is now a separate file displayed in a frame and one can copy it. Note that the file name is Windows style. Linux users will need to modify it. To download the file directly: export_html.txt.
The new code follows:
I hope you find it interesting.