Morning David,

Thought I felt my ears burning last night. Anyway, the code is fairly simple
but it does entail using OpenOffice and UNO which means that performance is
likely to be an issue - think of OLE/COM as the mechanism is the same.
Having said that, I would not even bother, simply locate an application
called JODConverter (http://www.artofsolving.com/opensource/jodconverter)
which already uses OpenOffice to perform file conversions (including Excel
to PDF) and take a good look at that. If then you still want to proceed with
using 'naked' UNO code (and I would not) then you wil have two options to
consider;

1. To build the workbook using POI, save it to a temporary file, read that
file using OpenOffice and then expeort the workbook as a PDF file.
2. To use OpenOffice to control the entire process; let it build the
workbook for you and then simply export it as a PDF file.

option 2 has the advantage of allowing you to go straight to the PDF file
but it also raises the spectre of building the workbook entirley using UNO
code. It cann be done but is not a trivial task to tackle. As UNO is
designed to support many different languages it is orientated heavilly
around factory classes to which you submit requests for objects, cast them
to the appropriate type and then execute methods on them to either get
further objects or acheiev some work. It takes a little getting used to and,
because Interfaces are so heavilly used throughout, the documentation seems
a little opaque at first as you try to work out what object you need to
achieve which task.

Also, there could be problems if the application is run on a server rather
than on a stand alone PC as I am still not certain about OpenOffice's
capabilities in this regard. I already have a class with the ability to
export to PDF format and will try to look it out over the weekend. When, and
if, I find it, I wil post the code here. 

If you still intend to use UNO, you will need to do a few things in advance
of this;

1. Download and install OpenOffice onto your machine.
2. Download and install the OpenOffice SDK onto your machine.
3. Locate and install the OpenOffice SDK plug-in for your development
environment. As far as I know, there are versions available for both
NetBeans and Eclipse. I would certainly advise you to install this plug-in
as the configuration will otherwise be quite complex and is certainly not
something I am qualified to talk you through.
4. Locate the supporting documentation for the UNO interface.
5. Join the oooforum.org website. There are lots of excellent code samples
there and far more experienced persons than I who can help out when you hit
problems - and I am confident that you will hit problems if you choose to
use 'naked' UNO.

Yours

Mark B

-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/convert-poi-generated-excel-to-pdf-tp3362053p3362486.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to