poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Beardsley <markbrd...@tiscali.co.uk>
Subject Re: How to copy data from Workbook to XSSFWorkbook
Date Thu, 25 Nov 2010 14:21:14 GMT

You cannot simply use the API to convert from one file format to another.
Although the classes in the SS model are common parents for many of those in
the HSSF and XSSF streams. You are faced with a couple of options;

Writing the code to read the .xsl file using HSSF, strip all of the
information from the workbook/sheet and then create a new copy using XSSF.
Thus, for each sheet you detect in the source workbook, you will need to
create a sheet in your copy. For each cell in each sheet of the source
workbook, yo will need to create a copy in the destination or copy sheet and
make sure that it's properties and contents are set appropriately. If your
source workbook is quite complex - i.e. if it includes charts for example -
you could also run into problems as not all features are supported in both
Use an established file conversion program such as JODConverter
Using OpenOffice and programming it's UNO interface to perform a conversion
from Java code. This is not the best option to pursue however as you will
simply be re-creatring JODConverter.


Mark B
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-copy-data-from-Workbook-to-XSSFWorkbook-tp3280010p3280117.html
Sent from the POI - User mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message