View Full Version : OpenOffice to Palm eReader export macro


poxi1023
03-13-2008, 09:00 PM
Hi all,
I'm quite new here, but I've read many posts here before.

I just wanted to let you know that I have written "odt2pml", a macro to export an OpenOffice Writer document to Palm eReader.

Quoting from my explanation:
odt2pml exports a Writer document into a "Palm Markup Language" tagged plain text file, ready to be processed by DropBook for Palm eReader.
odt2pml is WYSIWYG, within PML limitations: format your document as you like, and Palm eReader will show it mostly in a similar way. That includes character and paragraph styles, page breaks, chapter headings, footnotes, images and direct formatting (bold, italic, ...). Tables and text frames are not supported.
You may enable direct calling of DropBook in order to get a .pdb file ready to be synced to your handheld.

You may find it as an easy to install OpenOffice extension here:
http://extensions.services.openoffice.org/project/odt2pml

I'll be happy to know if it is useful for you, and also if there are bugs or possible improvements!

Cheers,
Peter

eimert
03-14-2008, 10:07 AM
Hi all,
I'm quite new here, but I've read many posts here before.

I just wanted to let you know that I have written "odt2pml", a macro to export an OpenOffice Writer document to Palm eReader.

Quoting from my explanation:
odt2pml exports a Writer document into a "Palm Markup Language" tagged plain text file, ready to be processed by DropBook for Palm eReader.
odt2pml is WYSIWYG, within PML limitations: format your document as you like, and Palm eReader will show it mostly in a similar way. That includes character and paragraph styles, page breaks, chapter headings, footnotes, images and direct formatting (bold, italic, ...). Tables and text frames are not supported.
You may enable direct calling of DropBook in order to get a .pdb file ready to be synced to your handheld.

You may find it as an easy to install OpenOffice extension here:
http://extensions.services.openoffice.org/project/odt2pml

I'll be happy to know if it is useful for you, and also if there are bugs or possible improvements!

Cheers,
Peter

Hi Peter,

I am not sure I understand. What is the difference to the "save as pdb" built in OpenOffice.

Klaus

poxi1023
03-14-2008, 10:37 AM
Hi Klaus,

OpenOffice offers the possibility to save in "Aportis Doc (.pdb)" format. But you will notice that all special formatting (bold, italic, large, superscript, etc.) gets lost. No support either for images, footnotes, chapter index, links, etc. On Palm you will see only a plain text file - "Aportis Doc" limitation.

PML (eReader) offers all these possibilities, and that is the reason for my macro.

Cheers,
Peter

eimert
03-14-2008, 05:11 PM
Hi Klaus,

OpenOffice offers the possibility to save in "Aportis Doc (.pdb)" format. But you will notice that all special formatting (bold, italic, large, superscript, etc.) gets lost. No support either for images, footnotes, chapter index, links, etc. On Palm you will see only a plain text file - "Aportis Doc" limitation.

PML (eReader) offers all this possibilities, and that is the reason for my macro.

Cheers,
Peter

Hi Peter,

I see - great idea! I never noticed that loss of formatting or maybe I just forgot - switched from Palm to PPC two years ago and didn't use pdb since then. I much prefer to read either rtf or html, now (using µBook). Coming to think about it, maybe the reason for preferring rtf is that my pdbs lost all the formatting in the conversion ...

CU,
Klaus

DaleDe
03-14-2008, 06:05 PM
Hi Peter,

I see - great idea! I never noticed that loss of formatting or maybe I just forgot - switched from Palm to PPC two years ago and didn't use pdb since then. I much prefer to read either rtf or html, now (using µBook). Coming to think about it, maybe the reason for preferring rtf is that my pdbs lost all the formatting in the conversion ...

CU,
Klaus

eReader with PML formatting runs just fine on a Pocket PC. I believe uBook can read them as well (at least uBook lite mentions PML) PML by the way is Palm Markup Language.

Dale

FRDV
03-24-2008, 09:38 AM
Hi Peter

Great job, I was searching something like this for long.

I tried your 3.1 macro with a fresh installation of OpenOffice (v2.3) under Windows and everythings worked well.


I have done a little change in function fnExportParaStyle to suit my own taste in paragraph formatting, in the following line:


if oPar.ParaFirstLineIndent > 100 then 'first line indented (more than 1 mm)
'sStr = "\a160\a160\a160\a160" & sStr '4 non-breaking spaces
sStr = "\t \t" & sStr


I think this is better like this.


To be perfect, your macro need a little more thing: delete the \a160\a160\a160\a160 (or my \t \t) when there is nothing else behind it.


Fred

poxi1023
03-24-2008, 02:58 PM
Hi, Fred,
thanks for trying out odt2pml! And thank you also for the suggestions. As soon as I find some time, I'll look into them.
Cheers,
Peter

poxi1023
04-11-2008, 12:02 AM
Hi, Fred,
finally I could look into your suggestions.

I like your first line indent very much - I didn't know that was possible. I'll put it into the next version of odt2pml.

I'm afraid I don't really see the point of your second suggestion. The end result, i. e. what you see on your Palm, is the same both ways - just an empty line.

Thanks for your suggestions, all are welcome!

Cheers,
Peter

poxi1023
05-01-2008, 03:18 PM
Hi all,
I just published version 3.2 of odt2pml. It includes bugfixes and improvements suggested by FRDV and others. FRDV made a french translation, included in this version. Thanks to him and to all who suggested improvements, reported bugs and voted for this extension!

I hope you will find it useful.

Cheers,
Peter

Lemurion
05-03-2008, 05:58 PM
I really like your macro. It's the best thing I've found yet to build .pdb eBooks. The only problem I have is that I've a very large number of eBooks I've purchased from Baen that I want to convert using your macro but there doesn't seem to be any way to do them in bulk rather than one at a time.

Is it possible to get it to work for multiple files sequentially?

(I am programming challenged or I would try to do it myself)

poxi1023
05-04-2008, 02:42 PM
Hi, Lemurion,
sorry, I have no idea about that. I am using my macro only to convert one single OOo document after another to .pdb, not multiple files in bulk.
I don't know about Baen either; are those files in OOo format?

Lemurion
05-04-2008, 03:03 PM
They are now-- they release them in .rtf and I was able to batch convert them to .odt pretty easily.

poxi1023
05-05-2008, 08:28 PM
I searched around on OOo's forum, the nearest I found is this thread:
http://www.oooforum.org/forum/viewtopic.phtml?t=11793.
It requires some macro programming though...
Hope it helps!

Robotech_Master
09-14-2008, 03:32 AM
Can someone tell me how I actually use this? I've installed it into my OOo, but I don't see any additional export or save options for PML markup. If I go into Macro Selector, it will only let me choose a single macro from the whole bundle, then says wrong number of parameters.

What am I doing wrong?

Robotech_Master
09-14-2008, 02:00 PM
OK, I figured out the wizard.

But can anyone tell me what kind of formatting I need to apply to render a plain vanilla chapter header? Header 1 renders \X1 and Header 2 renders \X2. What turns into just orginary \x (for a regular chapter header/page break)?

poxi1023
09-14-2008, 11:15 PM
When opening Writer, you should find a new Toolbar with 3 icons. The one on the right, named Export to eReader, calls the macro you are looking for. You will find the same 3 icons as submenu under Tools - Add-Ons - odt2pml.

On the wizard's first page you will find some help buttons explaining odt2pml usage, direct calling of DropBook, etc.

My idea when programming odt2pml was to make it as WYSIWYG as possible: What you see in OpenOffice Writer is what you get on your Palm (mostly, within PML limitations). That is why I don't use \x. If you want a page break before each chapter, just put it in your Header 1 (or 2, etc.) style in OOo. You will notice that it gets "translated" to \p before \X1 (or \X2, etc.). In the same way, if you want your chapter heading e. g. bold and centered, put bold and centered in your OOo chapter Header style.

Robotech_Master
09-14-2008, 11:39 PM
All right. I can't help thinking that's kind of silly, but then, I've done most of my PML markup up to this point by hand in emacs using search-and-replaces, and I prefer stuff to be as simple as possible. I can just search-and-replace X1 with x after I finish, I guess.

poxi1023
10-20-2008, 02:45 AM
New version just published

Version 4.0.0 comes with many new features: Extension help integrated into the OpenOffice.org help system. Added "Extract image" macro, configuration, extended footnote formatting, support for Polish characters and translations for ASCII Formatter.

Thanks for all feedback, bug reports, enhancement requests, etc.! Rup.Xamqon will continue with odt2pml (http://extensions.services.openoffice.org/project/odt2pml).

Rup.Xamqon
10-20-2008, 10:24 AM
Hi, everybody!
I took over odt2pml (http://extensions.services.openoffice.org/project/odt2pml) from poxi1023.

Please notice that due to many major changes, the new version we published does not update automatically. You should uninstall manually any previous odt2pml version in your OpenOffice, and then install the new version 4.0.0.

Any feedback is always welcome!

Rup.Xamqon
12-18-2008, 12:36 AM
New version published

odt2pml 4.1.0 (http://extensions.services.openoffice.org/project/odt2pml), with many new features: Improved Picture Converter and Extension Help (integrated into OpenOffice.org Help), added many PML features (sidebars, invisible chapter marks, horizontal rulers, flexible spacing, etc.) Almost all eReader formatting options are now handled by odt2pml (http://extensions.services.openoffice.org/project/odt2pml). Dialogs and Help available in 5 languages: de, en, es, fr, it.

:thanks: for all feedback, bug reports, enhancement requests, etc.!

da_jane
12-20-2008, 10:30 PM
I've installed OpenOffice and I see the toolbar in a "new document" but not in one that I open. Also, when I go to Tools, I don't see any option for "add-on". Finally, when I do click on a toolbar item in a new document, I get an error message:

A scripting Framework error occurred while running the Basic script vnd.sun.star.script:odt2html.ExtractG.subExtractWi zard?language=Basic&location=application.

Message: The following Basic script could not be found:
library: 'odt2html'
module: ExtractG'
method:SubExtractWizard'
location: application

Rup.Xamqon
12-20-2008, 11:11 PM
That seems to be a OpenOffice bug, I noticed it some time ago. After installing a new extension (sometimes even an upgrade), you have to shut down OpenOffice completely, including the Quickstarter. After loading OOo again, everything should work correctly.
Cfr.: http://www.openoffice.org/issues/show_bug.cgi?id=95779

da_jane
12-20-2008, 11:19 PM
Thanks. That took away the error message. Any explanation for why, when I open a new document (like an html file), I don't have the "add on" option?

Rup.Xamqon
12-21-2008, 12:08 AM
Cfr. odt2pml help, "HTML files":

If you want to use a HTML file with odt2pml, you must open it with the OOo filter "HTML Document (OpenOffice.org Writer)".
To access this command: Choose File – Open... – File type and select: HTML Document (OpenOffice.org Writer).
Normally it would be opened as "Web page" in Writer/Web, where odt2pml doesn't work.

Robotech_Master
12-23-2008, 01:41 PM
Is there any chance that odt2pml could have a function added that would take the ' and " quotation marks and replace them with ‘ and ’ and “ and ” in the right places?

This would probably be harder for single quotes (given their use as apostrophes and at the start of truncated words like 'round and 'til) but I'd think it should still be possible at least to some extent.

Rup.Xamqon
12-24-2008, 09:43 AM
I think it might be possible to program what you asked for - but it is really not that easy, specially with different languages having different kinds of quotation marks (“Spanish”, „German“, « French », etc...)

Anyway, it is not needed, because this function is already included in OpenOffice Writer:

1. In Tools - AutoCorrect edit the tab Custom Quotes to your liking.

2. In Format - Autoformat click Apply. That will change all single and double quotation marks to the ones you defined in the first step - but only in paragraphs formatted with the Default paragraph style.

odt2pml will translate each formatted quotation mark to the corresponding PML tag.

Robotech_Master
12-24-2008, 11:19 AM
All right, I tried that. And it did change the quotation marks beautifully.

However, it also reformatted everything in the document to "Default", including the headers which I would have liked to keep in place for the macro to make chapter titles out of.

Any way around that?

Rup.Xamqon
12-24-2008, 11:31 AM
That is strange. It does not happen in my text (OOo 3 with Kubuntu Intrepid). It leaves all formatting (direct and styles) in place.

Are your chapter titles formatted with some "Heading" style?
Are you using OOo 3? What OS?
You might check Tools - AutoCorrect - Options tab, and change some settings there.

Gypsy Jane
01-27-2009, 11:35 PM
I came to the forum to post that exact error message. So nice to see the answer here already. :bulb2: I had reinstalled the extension and it still hadn't found it. Works great, now. Thanks.
- Gypsy Jane

That seems to be a OpenOffice bug, I noticed it some time ago. After installing a new extension (sometimes even an upgrade), you have to shut down OpenOffice completely, including the Quickstarter. After loading OOo again, everything should work correctly.
Cfr.: http://www.openoffice.org/issues/show_bug.cgi?id=95779

Rup.Xamqon
02-28-2009, 06:49 PM
odt2pml 4.2.1 (http://extensions.services.openoffice.org/project/odt2pml)

Completely new Text Converter: Enhanced AutoCorrect, uppercase words to italic, _xxx_ to italic, first words in chapter to uppercase... New ConfigManager. More info (how many converted, time...).

After re-reading Robotech_Master's request, I noticed I had overlooked "X0" (first heading, no indent). It's added now!

:thanks: for all feedback, bug reports, enhancement requests, etc.!