审计出结果EXCEL导出
发布日期:2021-09-30 18:11:17
浏览次数:35
分类:技术文章
本文共 3574 字,大约阅读时间需要 11 分钟。
/** * * 方法描述:XX审计结果输出到Excel去中 * @param auditVOList * @param type */ private String numDataWriteExcel(List auditVOList) { Date todate=new Date(); SimpleDateFormat sdf=new SimpleDateFormat("yyMMddHHmmss"); String fileName="omcAudit"+sdf.format(todate)+".xls"; File saveFile=new File(this.getUpLoadPath()+fileName); WritableWorkbook wbook=null; try { wbook=Workbook.createWorkbook(saveFile); WritableSheet sheet1=this.createNewPrefixSheet(wbook, 0); /*************输出omcXX审计结果**************/ WritableCellFormat format2=new WritableCellFormat(); format2.setBorder(Border.ALL, BorderLineStyle.THIN); WritableFont font2=new WritableFont(WritableFont.TIMES,8,WritableFont.NO_BOLD); //字体、大小、粗细 font2.setColour(Colour.RED); //差异描述的颜色为红色 WritableCellFormat format3=new WritableCellFormat(font2); format3.setBorder(Border.ALL, BorderLineStyle.THIN); int currCount=0; /* 添加数据 */ for(int i=0;i30000) { //EXCEL表格中sheet的个数 int sheetCount=wbook.getSheets().length; sheet1=this.createNewPrefixSheet(wbook, sheetCount); currCount=0; } MPVO numDataVO=(MPVO)auditVOList.get(i); Label blabel1=new Label(0,currCount+1,numDataVO.getXXX(),format2); sheet1.addCell(blabel1); Label blabel2=new Label(1,currCount+1,numDataVO.getXXX(),format2); sheet1.addCell(blabel2); Label blabel3=new Label(2,currCount+1,numDataVO.getXXX(),format2); sheet1.addCell(blabel3); Label blabel4=new Label(3,currCount+1,numDataVO.getXXX(),format2); sheet1.addCell(blabel4); Label blabel5=new Label(4,currCount+1,numDataVO.getXXX(),format2); sheet1.addCell(blabel5); Label blabel6=new Label(5,currCount+1,numDataVO.getXXX(),format2); sheet1.addCell(blabel6); Label blabel7=new Label(6,currCount+1,numDataVO.getXXX().toString(),format3); sheet1.addCell(blabel7); } wbook.write(); //System.out.println("******************"+wbook.getSheets().length); sheet长度 wbook.close(); return fileName; } catch (IOException e) { } catch (WriteException e) { } return null; } /** * 记录数超过30000条,就创建一个新的WAP sheet * @param wbook * @param sheetCount * @return * @throws WriteException */ private WritableSheet createNewWapSheet(WritableWorkbook wbook, int sheetCount) throws WriteException { WritableSheet sheet = wbook.createSheet("sheet"+sheetCount, sheetCount);//Excel的第一页 WritableFont font1=new WritableFont(WritableFont.TIMES,8,WritableFont.BOLD); //字体、大小、粗细 WritableCellFormat format1=new WritableCellFormat(font1); format1.setAlignment(Alignment.CENTRE); //对齐方式 format1.setBackground(Colour.GRAY_25); //背景颜色 format1.setBorder(Border.ALL, BorderLineStyle.THIN);//边框 /*****************Excel的表头********************/ Label label1=new Label(0,0,"AAAA",format1); sheet.addCell(label1); Label label2=new Label(1,0,"审计未通过的原因",format1);sheet.addCell(label2); return sheet; }
转载地址:https://blog.csdn.net/iteye_10361/article/details/81688746 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过,博主的博客真漂亮。。
[***.116.15.85]2024年03月22日 01时37分51秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
mysql 怎样链接jdbc_jdbc怎么链接mysql数据库
2019-04-21
java exec封装_Java 执行系统命令工具类(commons-exec)
2019-04-21
php将文件夹打包zip文件,PHP把文件夹打包成ZIP文件
2019-04-21
mysql in 逗号分隔,使用MySQL IN()从逗号分隔的值中获取记录?
2019-04-21
php静态页面示例,php生成静态页面的简单示例_php实例
2019-04-21
迭代函数系统matlab实现,线性随机IFS迭代Matlab示例程序.doc
2019-04-21
c语言程序设计教程谭浩强张基温,C语言程序设计教程(第2版)
2019-04-21
exfat默认配置大小_mac开发配置技巧
2019-04-21
k8s边缘节点_边缘计算容器及K8S应用的三种场景及部署选项
2019-04-21
诸葛io的技术架构图_基于泳道技术生成“无数”个测试环境
2019-04-21
互相引用 spring_# 技术笔记:spring、springBoot源码解析
2019-04-21
华为发布岳云鹏手机_鸿蒙2.0正式发布:明年华为手机全面升级
2019-04-21
ifpc挖filecoin_Filecoin挖矿分析全套 不容错过的干货
2019-04-21