Page 1 of 1

xlsx to pdf

PostPosted: Sat May 05, 2012 8:35 am
by rball
Does the docX4j jars provided a way to convert an .xlsx file to a .pdf? If so is there example code somewhere?
Thanks
Roger

Re: xlsx to pdf

PostPosted: Tue May 08, 2012 8:48 pm
by jason
There's nothing built in at this time which does this for you.

Since a spreadsheet is basically a table, going to an XHTML table, and from there to PDF (using http://code.google.com/p/flying-saucer/ ), is probably a sensible approach.

Or you could go from XLSX to a docx table, and use what is in docx4j already to convert that to a PDF.

Or you can go XLSX to FO to PDF (which is what we do for docx). Or you could use iText...

One limitation to be aware of: xlsx4j won't do calculations for you, so if your spreadsheet contains these, you may be better off using a different library (eg POI or LibreOffice), since you'll probably need to use that to perform the calculations first.