1. HSSFWorkbook wb = new HSSFWorkbook();
2. HSSFSheet sheet = wb.createSheet("new sheet");
3. HSSFRow row = sheet.createRow((short) 0);
4. HSSFCell cell = row.createCell((short) 0);
5. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
6. cell.setCellValue("缴费日期");
7. cell = row.createCell((short) 1);
8. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
9. cell.setCellValue("缴费号");
10. cell = row.createCell((short) 2);
11. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
12. cell.setCellValue("金额");
13. cell = row.createCell((short) 3);
14. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
15. cell.setCellValue("手续费");
16. cell = row.createCell((short) 4);
17. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
18. cell.setCellValue("缴费类型");
19. cell = row.createCell((short) 5);
20. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
21. cell.setCellValue("卡号后4位");
22. cell = row.createCell((short) 6);
23. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
24. cell.setCellValue("手机号");
25. cell = row.createCell((short) 7);
26. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
27. cell.setCellValue("流水号");
28.jnlsList = this.getBill2Service().getJnlsListByCriteria(
29. detachedCriteria);
30. Iterator itr = jnlsList.iterator();
31.
32. WtPepJnls wtj;
33. short rowNum = 1;
34. String temp = "";
35. while (itr.hasNext()) {
36. wtj = (WtPepJnls) itr.next();
37. row = sheet.createRow(rowNum);
38. cell = row.createCell((short) 0);
39. temp = wtj.getPepdate();
40. temp = temp.substring(0, 4) + "-"
41. + temp.substring(4, 6) + "-"
42. + temp.substring(6,
;
43. cell.setCellValue(temp);
44. cell = row.createCell((short) 1);
45. cell.setCellValue(wtj.getIntcdno());
46. cell = row.createCell((short) 2);
47. temp = "¥" + Util.FormatSum(wtj.getTranamt());
48. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
49. cell.setCellValue(temp);
50. cell = row.createCell((short) 3);
51. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
52. cell.setCellValue("¥0.00");
53. cell = row.createCell((short) 4);
54. cell.setEncoding(HSSFCell.ENCODING_UTF_16);
55. temp = wtj.getTrancde();
56. if (temp.equals("M22")) {
57. cell.setCellValue("水费");
58. } else if (temp.equals("M24")) {
59. cell.setCellValue("电费");
60. } else if (temp.equals("M26")) {
61. cell.setCellValue("燃气费");
62. } else if (temp.equals("M2H")) {
63. cell.setCellValue("交通罚没费");
64. }
65. cell = row.createCell((short) 5);
66. temp = wtj.getOutcdno();
67. cell.setCellValue(temp.substring(12, 16));
68. cell = row.createCell((short) 6);
69. cell.setCellValue(wtj.getTermid());
70. cell = row.createCell((short) 7);
71. cell.setCellValue(wtj.getId().getTrace());
72.
73. rowNum++;
74. }
75. response.setContentType("octets/stream");
76. response.addHeader("Content-Disposition",
77. "attachment;filename=all.xls");
78.
79. OutputStream fileOut = response.getOutputStream();
80. wb.write(fileOut);
81. fileOut.close();
82. return null;
分享到:
相关推荐
将simulink示波器数据导出到excel表格教程将simulink示波器数据导出到excel表格教程将simulink示波器数据导出到excel表格教程将simulink示波器数据导出到excel表格教程将simulink示波器数据导出到excel表格教程将...
C#大量数据导出到Excel,超过65536行时自动分页导出
轻松让java 将数据导出到Excel中,java让开发更简单。
如何将WinCC归档的历史数据导出到EXCEL CSV文件,此压缩包包含文档和附件。详细介绍了开发过程,初学者可以参考。
落阳-利用NPOI将EasyuiDatagrid数据导出到Excel-ASP.NET MVC Demo
把datagridview中的数据导出到excel
从数据库中获取数据显示在Datagridview中,然后将数据导入到excel或从Dataset直接将数据导出到excel
Java SE程序 把Jtable中的数据导出到Excel中Java SE程序 把Jtable中的数据导出到Excel中Java SE程序 把Jtable中的数据导出到Excel中Java SE程序 把Jtable中的数据导出到Excel中Java SE程序 把Jtable中的数据导出到...
数据导出到Excel.html ,数据导出到Excel.html
两种不同方法实现数据导出到Excel,绝对有用
C# 将数据导出到Excel各种方法汇总
winform中将Datatable数据导出到Excel表格中,该项目包含了例子,能使个人能更加了解winform将datatable数据导出到excel的整个流程,本资源也可拿来即用,只需要稍加修改即可。
dataGridView控件中的数据导出到Excel所需要的三个.dll文件
将sql数据导出到excel是站长通常使用的一款用户说明工具,目的是将程序中的数据更清楚的展示给不懂的非程序设计者,也起到相关的保密工作,A5源码小编从网上找到这款sql数据导出到excel软件,希望可以帮助到有所需求...
C#将数据导出到Excel汇总 一、asp.net中导出Execl的方法: 在asp.net中导出Execl有两种方法,一种是将导出的文件存放在服务器某个文件夹下面,然后将文件地址输出在浏览器上;一种是将文件直接将文件输出流写给...
两种方法将easyui datagrid 中的数据导出到Excel中,均以验证可以正常使用
将JTable中的内容导出到Excel保存,支持更改保存的EXcel名字
asp代码,将数据导出到excel中
C#数据表中的数据导出到excel(web,WinFrom)
数据导出到Excel源码 本例子使用的数据库是sql2000中的Northwind数据库,所以在例子中就没有打包数据库了,例子使用的vs2008+sql2000开发的, 主要功能就是将Girdview,DataList,DetailView,Repeater中的数据导出到...