Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Module to generate OpenOffice Writer documents (http://www.velocityreviews.com/forums/t322633-re-module-to-generate-openoffice-writer-documents.html)

python 09-18-2003 12:34 AM

Re: Module to generate OpenOffice Writer documents
 
On Wed, 17 Sep 2003 19:53:15 -0400
"Ellinghaus, Lance" <lance.ellinghaus@eds.com> wrote:

> Has anyone created a module to generate the XML formatted files for
> OpenOffice?
>


Sorry, I can't help you there.

What I'd be even more interested in is if it is possible to submit the
xml to OpenOffice, and then use its rendering features to crank out
pretty PDF files, all through scripts.


Jordan Krushen 09-18-2003 01:19 AM

Re: Module to generate OpenOffice Writer documents
 
On Wed, 17 Sep 2003 20:34:41 -0400, python <python@sarcastic-horse.com>
wrote:

> What I'd be even more interested in is if it is possible to submit the
> xml to OpenOffice, and then use its rendering features to crank out
> pretty PDF files, all through scripts.


The Python-UNO bridge might do the trick for you. It lets you
programatically control OOo apps:

http://udk.openoffice.org/python/python-bridge.html

J.


Erwin S. Andreasen 09-20-2003 02:45 PM

Re: Module to generate OpenOffice Writer documents
 
python <python@sarcastic-horse.com> writes:

> On Wed, 17 Sep 2003 19:53:15 -0400
> "Ellinghaus, Lance" <lance.ellinghaus@eds.com> wrote:
>
> > Has anyone created a module to generate the XML formatted files for
> > OpenOffice?
> >

>
> Sorry, I can't help you there.
>
> What I'd be even more interested in is if it is possible to submit the
> xml to OpenOffice, and then use its rendering features to crank out
> pretty PDF files, all through scripts.


I do almost exactly that, though the output is Power Point rather than
PDF.

I originally wanted to do this using the Python UNO API but that
proved somewhat difficult to use (although the Office Basic API is
also horrible).

So all I do is to generate a OO XML file, stick it in a fixed location
then call:
soffice -display :1 macro:///Standard.Module1.NewConvert

where the Standard.Module1.NewConvert macro is one that opens the
file, saves as PPT and closes the document again (the macro is easy
enough to generate using the macro recording feature).

The display at :1 is a virtual framebuffer (xvfb) where OpenOffice is
running -- calling soffice if it is already running asks the main
program to synchronously run the macro and the soffice command exits
once the main program is done with its execution.

As for the XML input file: I generate most of it by hand. I started
out by generating everything to the specs I wanted (styles, etc.) and
saving that file. The .SX? files are just ZIP files, with the the
content stored in the 'content.xml' file, the format of which is
decently documented. So you can take your template and just build on
top of it.

This is much nicer than generating RTF by hand, which I also do in the
same program :)

This guy provides automated conversion online using a similar system:

http://oooconv.free.fr/engine/OOOconv.php



--
================================================== =============
<erwin@andreasen.org> Herlev, Denmark
<URL:http://www.andreasen.org/> <*>
================================================== =============



All times are GMT. The time now is 07:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.