ExcelUtils 模板操作类
http://excelutils.sourceforge.net
rainsoft: http://www.try2it.com/blog
jokeway: http://spaces.msn.com/members/jokeway
We're headache on making web report all long. ExcelUtils is a helper to export excel report in java web project. It's like velocity, has own tags, but these tags is written in excel file. By these tags, you can custom your excel report format freely, not edit any your source, just ExcelUtils parses your excel template and fills values to export your report. It is based POI project and beanutils project. It uses excel and template language's profit to make web reports easily.
After my hardwork, the parser is finished finally, in which report is exported by Excel Template. It's funtions include:
dependency library:
poi-2.5.1.jar (required)
commons-beanutils.jar (required)
commons-digester.jar (required)
commons-logging.jar (required)
ognl.jar (build required, webwork demo required)
xwork.jar (build required, webwork demo required)
webwork-2.1.7.jar (build required, webwork demo required)
oscore.jar (webwork deom required)
struts.jar (struts demo required)
修复bug
zxh fix bug 1、兼容poi 3.0以上的版本。 2、修复 超出execl 的ROW_LAST_COLUMN_NUM最大数 255 3、修改了用groovy代替原来的计算
例子
@RequestMapping("export") public void export(HttpServletRequest request, HttpServletResponse response) throws Exception { Listlist = XXX.getAll(); net.sf.excelutils.ExcelUtils.addValue("list", list); String config = "/WEB-INF/xls/test.xls"; response.reset(); response.setContentType("application/vnd.ms-excel"); try { net.sf.excelutils.ExcelUtils.export(request.getSession().getServletContext(), config, response.getOutputStream()); } catch (Exception e) { e.printStackTrace(); } }