| View previous topic :: View next topic |
| Author |
Message |
Leho21 Guest
|
Posted: Tue Nov 25, 2003 3:50 am Post subject: Document convertion |
|
|
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
--input-document=/path/to/my/document
--print-to-file=/path/to/my/printout
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 |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Tue Nov 25, 2003 7:27 am Post subject: |
|
|
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.
http://www.oooforum.org/forum/viewtopic.php?t=3772
http://www.oooforum.org/forum/viewtopic.php?t=3196
http://www.oooforum.org/forum/viewtopic.php?t=2619
You can also get some programming examples of how to convert documents from here....
http://kosh.datateamsys.com/~danny/OOo/Examples/Conversions/
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
http://www.oooforum.org/forum/viewtopic.php?t=3549
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....
http://www.oooforum.org/forum/viewtopic.php?t=4071
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
http://OOoMacros.org
it is called Document Converter. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
Leho21 Guest
|
Posted: Tue Nov 25, 2003 11:50 pm Post subject: |
|
|
| BIG thanks for your BIG help. |
|
| Back to top |
|
 |
|
|
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
|