
POI
JoyceYoungYYY
这个作者很懒,什么都没留下…
展开
-
Java使用POI导出Excel .xlsx提示文件格式或文件扩展名有误
这里写目录标题1.前端如果用xlsx格式接收表格2.前端如果用xls格式接收表格 1.前端如果用xlsx格式接收表格 后台用XSSFWorkbook workbook = new XSSFWorkbook();创建工作薄 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.addHeader("Content-Disposition", "attach原创 2020-11-04 15:25:33 · 1437 阅读 · 0 评论 -
poi导出excel实例
controller @RequestMapping({"/export"}) public void export(String fileName, String fieldStr, String filterStr, HttpServletResponse res) throws BizException { try { URL xmlPath = this.getClass().getClassLoader().getResource("");原创 2020-06-13 14:33:12 · 308 阅读 · 0 评论 -
POI使用cell.getCellStyle()设置指定单元格颜色,但是其它没有指定的单元格也会变色
描述 HSSFCell cell = row.createCell((short)i); cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_RIGHT); … 你可能发现创建后的excel文件所有的列都变成右对齐了… 翻了翻代码,还挺复杂,大意就是在创建的xls的时候会产生若干默认的ExtendedFormatRecord,这样在调用 row.createCell((short)i)创建普通的cell的时候,如果POI没有办法根据cel原创 2020-05-22 18:18:01 · 1838 阅读 · 0 评论