/** * 导出对象到Excel,直接新建一个Excel完成导出,基于路径的导出,不基于模板 * * @param outPath 导出路径 * @param objs 对象列表 * @param clz 对象类型 * @param isXssf 是否是2007版本 */ public void exportExcelByPath( String outPath, List objs, Class clz, boolean isXssf, String message) { Workbook wb = handleExcel(objs, clz, isXssf, message); FileOutputStream fos = null; try { fos = new FileOutputStream(outPath); wb.toString().getBytes("GB2312"); wb.write(fos); } catch (FileNotFoundException e) { e.printStackTrace(); logger.error(e); } catch (IOException e) { e.printStackTrace(); logger.error(e); } finally { try { if (fos != null) fos.close(); } catch (IOException e) { e.printStackTrace(); logger.error(e); } } }