模板
代码: List supplyAreaList = saBiz.getSupplyAreaById(supplyAreaId); List stationList = staBiz.getRecordById("490"); String templateDir = "D:/excel/template/SupplyAreaMultipleEntityInSheet.xls"; String targetDir="D:/excel/export/testSupplyAreaMultipleEntityInSheet.xls"; InputStream is = new FileInputStream(templateDir); OutputStream os = new FileOutputStream(targetDir); Map beans = new HashMap(); beans.put("suplyArea", supplyAreaList); beans.put("station", stationList); XLSTransformer transFormer = new XLSTransformer(); HSSFWorkbook workBook = transFormer.transformXLS(is, beans); workBook.write(os); is.close(); os.flush(); os.close();
导出结果