POIFSFileSystem fs = new POIFSFileSystem( new FileInputStream("template.xls")); HSSFWorkbook wb = new HSSFWorkbook(fs, true);
Will load an xls, preserving its structure (macros included). You can then modify it,
HSSFSheet sheet1 = wb.getSheet("Data"); ...
and then save it.
FileOutputStream fileOut = new FileOutputStream("new.xls"); wb.write(fileOut); fileOut.close();
http://stackoverflow.com/questions/714172/poi-using-excel-templates
Nessun commento:
Posta un commento