Minimal excel publication method w/ file naming

Minimal excel publication method w/ file naming
0
(scampano) #1
public byte[] pubExcel(PrintTemplate pt){
	pt.setFilename(pt.getFilename().replace("[attr]", getFieldValue("attr")));
	try{
		ExcelPOITool xls = new ExcelPOITool(true);
		ExcelPOITool.ExcelSheet sheet = xls.newSheet("Feuille 1");
		sheet.addFullRow(0, new String[]{"A", "B", "C"}); // at line 0
		xls.add(sheet);
		return xls.generateToByteArray();	
	}
	catch(Exception e){
		AppLog.error(getClass(), "pubExcel", "Excel generation error", e, getGrant());
		return null;
	}
}
1 Like