Monday, September 22, 2014

Creating excel sheet from template in Java, new versions of Excel

Workbook wb = new XSSFWorkbook( OPCPackage.open("template.xlsx") );
Sheet sheet = wb.getSheetAt(0);

// Make changes to the sheet
sheet.getRow(2).getCell(0).setCellValue("Changed value"); // For example

// All done
FileOutputStream fileOut = new FileOutputStream("new.xls"); 
wb.write(fileOut);
fileOut.close();


http://poi.apache.org/spreadsheet/examples.html


No comments:

Post a Comment