WritableWorkbook book = Workbook.createWorkbook(new File(inputFile));
WritableSheet sheet = book.createSheet(inputFile, 0);
sheet.setName(fileName);
// WritableFont tf = new WritableFont(WritableFont.TIMES, 16, WritableFont.BOLD);
// WritableCellFormat cf = new WritableCellFormat(tf);
// cf.setBackground(Colour.GRAY_25);
//// cf.setAlignment(Alignment.CENTRE);
//// cf.setVerticalAlignment(VerticalAlignment.CENTRE);
// Label label = new Label(0, 0, fileName, cf);
//// label.setCellFormat(cf);
// sheet.addCell(label);
// sheet.mergeCells(0, 0, 40, 0);
// sheet.setRowView(0, 400);
// WritableCell newCell = new
book.write();
book.close();
//生成excel文件
public FileTransfer downloadExcel(String fileName) throws Exception {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
WritableWorkbook book = Workbook.createWorkbook(buffer);
// WritableWorkbook book = Workbook.createWorkbook(new File(reportCode));
WritableSheet sheet = book.createSheet(fileName, 0);
sheet.setName(fileName);
// book.write();
// book.g
// book.close();
return new FileTransfer(fileName + ".xls", "application/vnd.ms-excel", buffer.toByteArray());
}