jxl将html表单中数据写入到excel_html/css_WEB-ITnose
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了jxl将html表单中数据写入到excel_html/css_WEB-ITnose,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1919字,纯文字阅读大概需要3分钟。
内容图文
首先下载jxl-2.6.12.jar或者在maven中添加net.sourceforge.jexcelapi jxl2.6.12
后台代码如下:
WritableWorkbook wwb = null; wwb=Workbook.createWorkbook(new File("c:\\1.xls"));//创建excel文件 WritableSheet ws = wwb.createSheet("sheet1", 0);//创建一个可写入的工作表 ws.setColumnView(11,30);//设置列的宽度 ws.setColumnView(0,25); ws.setColumnView(6,20); ws.setColumnView(9,20); //设置表头 ws.addCell(new Label(0,0,"商品图片")); ws.addCell(new Label(1,0,"商品名称")); ws.addCell(new Label(2,0,"市场价格")); ws.addCell(new Label(3,0,"会员价格")); ws.addCell(new Label(4,0,"被测人")); ws.addCell(new Label(5,0,"状态")); ws.addCell(new Label(6,0,"收样品时间")); ws.addCell(new Label(7,0,"收件人")); ws.addCell(new Label(8,0,"物流单号")); ws.addCell(new Label(9,0,"发报告时间")); ws.addCell(new Label(10,0,"物流单号")); ws.addCell(new Label(11,0,"检测报告")); //添加行数据,遍历需要写入excel的集合数据 for (int i=1;i<=odvs.size();i++){ OrderDetailVo row=odvs.get(i-1); System.out.println(row); ws.addCell(new Label(0,i,row.getThumbNail())); ws.addCell(new Label(1,i,row.getName())); ws.addCell(new Label(2,i,row.getMarketPrice().toString())); ws.addCell(new Label(3,i,row.getMemberPrice().toString())); ws.addCell(new Label(4,i,row.getPersonName())); ws.addCell(new Label(5,i,row.getStatus())); ws.addCell(new Label(6,i,row.getRecieveOrderDate().toString())); ws.addCell(new Label(7,i,row.getContact())); ws.addCell(new Label(8,i,row.getReceiveTrackNumber())); ws.addCell(new Label(9,i,row.getReportSendDate().toString())); ws.addCell(new Label(10,i,row.getReportTrackNumber())); ws.addCell(new Label(11,i,row.getReportDownloadPath())); } wwb.write();//从内存中写入文件中 wwb.close(); //关闭资源,释放内存
转换后的1.xls文档如下
参考文章:
http://pengfeicao521.iteye.com/blog/1415699
内容总结
以上是互联网集市为您收集整理的jxl将html表单中数据写入到excel_html/css_WEB-ITnose全部内容,希望文章能够帮你解决jxl将html表单中数据写入到excel_html/css_WEB-ITnose所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。