Forum at OOoForum.orgThe Forum
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Document convertion

Post new topic   Reply to topic Forum Index -> Macros and API
View previous topic :: View next topic  
Author Message

PostPosted: Tue Nov 25, 2003 3:50 am    Post subject: Document convertion Reply with quote

There are some command line argument for openoffice, but I think they are few. I would like to see there someting like:

program --input-document=mydocument.xls --output-document=mydocument.txt --delimiter=tab


And other things like that. So i can use them in bash shell scripts or bat files. Or is there any way to achieve this goal.
Back to top

Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Nov 25, 2003 7:27 am    Post subject: Reply with quote

It is not quite as simple as you would like, but it is possible because of two facts...

1. If you write macros in Basic, it is quite easy to open a document and then save it in another format. I have posted a number of examples here before.

2. It is possible to call OOo from the command line (even if it is already running) and specify that a macro be executed. See these discussions.

You can also get some programming examples of how to convert documents from here....
These look like empty drawings, but see the macro code within the document for examples of opening and converting documents.

You can probably adapt any of the above examples to convert from any format into any other format, simply by specifying the name of the correct import and/or export filters.

In the past I have posted
a list of the names of import and export filters for OOo.

Usually, you don't need to specify an input filter. Just do the loadComponentFromURL(), and OOo will figure out what the incomming document type is based on the extension. You always need to specify the filter name on the storeToURL() method.

There are a few pathologic cases where OOo's type detection works against you at the loadComponentFromURL. One recent example is in converting HTML into Word. Sorry I don't have a link to the discussion, but it was recently discussed in this forum. The problem was that OOo would open an html file as a Web document. A web document has very few export optiosn. The trick was to use an Import filter to cause OOo to open the html into a Writer document, which has many export options, including Word. One of the conversion examples linked above does show the use of an import filter to convert Html to Word.

Here is some additional information....

Finally, if you just need to convert a batch of documents from one format to another, I have written a macro which may be useful. It has a wizard-style dialog interface. It doesn't support every possible input and output filter, but it does a wide variety of useful conversions. Get it at
it is called Document Converter.
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message

PostPosted: Tue Nov 25, 2003 11:50 pm    Post subject: Reply with quote

BIG thanks for your BIG help.
Back to top
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> Macros and API All times are GMT - 8 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group