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 formats. Use an established file conversion program such as JODConverter http://www.artofsolving.com/opensource/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. Yours 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: [email protected] For additional commands, e-mail: [email protected]
