Using Excel templates with Apache POI

Jake :

Basic question: How do I load an Excel template for use with POI and then save it to an XLS file?

Edit:

The answer is:

FileInputStream inputStream = new FileInputStream(new File(templateFile));
Workbook workbook = new HSSFWorkbook(inputStream);

(Just load the template as a workbook and then write the workbook as an XLS file elsewhere.)

Brian Agnew :

Have you tried loading it up as a standard .xls using POI, amending it and then saving it ?

This is the approach I've used for inserting macros in a POI-generated .xls. I create the file with the macro (admittedly as an .xls) and then load it into my app, populate with data and save as a newly-created .xls. That all worked fine.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related