java poi导出excel含工具类以及示例

时间:2021-08-22 05:04:56
【文件属性】:

文件名称:java poi导出excel含工具类以及示例

文件大小:6.04MB

文件格式:ZIP

更新时间:2021-08-22 05:04:56

导出EXCEL 工具类 示例

public static void main(String[] args) { try{ String outputFile = "D:\\excel\\excel.xlsx"; OutputStream outputStream = new FileOutputStream(outputFile); UtilExcel utilExcel = new UtilExcel(); String titles = "所属区域,所属车间,当前处理人,描述,状态,上报人,上报车间,上报时间"; String cols = "EXTEND10,PARENTNAME|ORGNAME,CURRENTUSER,HDREMARK,AUDITSTATUSFMT,USERNAME,ORGNAMEREPORT,CREATEDONFMT"; String symbol = "->"; List listMap = new ArrayList(); Map map = new HashMap(); map.put("EXTEND10", "EXTEND10"); map.put("PARENTNAME", "PARENTNAME"); map.put("ORGNAME", "ORGNAME"); map.put("CURRENTUSER", "CURRENTUSER"); map.put("HDREMARK", "HDREMARK"); map.put("AUDITSTATUSFMT", "AUDITSTATUSFMT"); map.put("USERNAME", "USERNAME"); map.put("ORGNAMEREPORT", "ORGNAMEREPORT"); map.put("CREATEDONFMT", "CREATEDONFMT"); listMap.add(map); Object obj = utilExcel.exportExcel(listMap, cols,titles,symbol); XSSFWorkbook wb = (XSSFWorkbook)obj; wb.write(outputStream); outputStream.flush(); outputStream.close(); System.out.println("==========="); }catch(Exception e){ }


【文件预览】:
java导出EXCEL
----poi-3.8-20120326.jar(1.74MB)
----poi-ooxml-3.8-20120326.jar(911KB)
----poi-ooxml-schemas-3.8-20120326.jar(4.49MB)
----UtilExcel.java(13KB)
----poi-tl-1.2.0.jar(58KB)

网友评论