在Excel的一个sheet中导出大于20万的数据
来源:互联网 发布:渡边直美自创品牌淘宝 编辑:程序博客网 时间:2024/05/20 16:09
第一:引用poi包。
http://download.csdn.net/detail/bucce/4356293
第二:导出程序修改。
FileInputStream file =null;
OutputStream out = null;
Workbook wb = null;
Sheet sheet = null;
wb = new SXSSFWorkbook(1000);
sheet =wb.createSheet("CSDAA010");
int start = 0;
int limit = 60000;
boolean b =true;
while(b)
{
selectSetbiItirannModel.setStart(start);
selectSetbiItirannModel.setLimit(limit);
long stimee = java.util.Calendar.getInstance().getTimeInMillis();
List<SDA_VA_Daicho_A> kennsakuSetubiDaitixyouKannri = itiranservice.kennsakuSetubiDaitixyouKannriA(selectSetbiItirannModel);
double db = Double.parseDouble((java.util.Calendar.getInstance().getTimeInMillis() - stimee)+ "") * 0.001;
System.out.println("第"+ie+"回----------"+ Double.parseDouble((java.util.Calendar.getInstance().getTimeInMillis() - stimee)+ "") * 0.001 +"秒");ie++;
if (kennsakuSetubiDaitixyouKannri.size() < limit)
{
b = false;
} else
{
start += limit;
}
}
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;fileName="+ OutName);
out = response.getOutputStream();
wb.write(out);
第三:样式代码
//=
CellStyle styletb1 = wb.createCellStyle();
styletb1.setBorderBottom(CellStyle.BORDER_THIN);
styletb1.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styletb1.setBorderTop(CellStyle.BORDER_THIN);
styletb1.setTopBorderColor(IndexedColors.BLACK.getIndex());
//|=
CellStyle styletb2 = wb.createCellStyle();
styletb2.setBorderBottom(CellStyle.BORDER_THIN);
styletb2.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styletb2.setBorderLeft(CellStyle.BORDER_THIN);
styletb2.setLeftBorderColor(IndexedColors.BLACK.getIndex());
styletb2.setBorderTop(CellStyle.BORDER_THIN);
styletb1.setTopBorderColor(IndexedColors.BLACK.getIndex());
//=|
CellStyle styletb3 = wb.createCellStyle();
styletb3.setBorderRight(CellStyle.BORDER_THIN);
styletb3.setRightBorderColor(IndexedColors.BLACK.getIndex());
styletb3.setBorderBottom(CellStyle.BORDER_THIN);
styletb3.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styletb3.setBorderTop(CellStyle.BORDER_THIN);
styletb1.setTopBorderColor(IndexedColors.BLACK.getIndex());
//|=|
CellStyle styletb4 = wb.createCellStyle();
styletb4.setBorderRight(CellStyle.BORDER_THIN);
styletb4.setRightBorderColor(IndexedColors.BLACK.getIndex());
styletb4.setBorderBottom(CellStyle.BORDER_THIN);
styletb4.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styletb4.setBorderLeft(CellStyle.BORDER_THIN);
styletb4.setLeftBorderColor(IndexedColors.BLACK.getIndex());
styletb4.setBorderTop(CellStyle.BORDER_THIN);
styletb1.setTopBorderColor(IndexedColors.BLACK.getIndex());
- 在Excel的一个sheet中导出大于20万的数据
- ASP.NET将数据导出到一个EXCEL文件的多个SHEET中
- Dataset导出excel的不同sheet中
- 将Excel中所有Sheet的数据导入一个DataSet
- 将Excel中所有Sheet的数据导入一个DataSet
- excel sheet中数据的快速复制
- phpexcel 读取含多个sheet的excel,将从数据库中检索出的数据分别写入该excel不同的sheet中 并导出该excel
- 考试系统--导出Dataset的数据到Excel的不同sheet中
- 关于导出excel 把一个dataset的多个datatable导入到一个excel的多个sheet中
- 导出Excel 把一个dataset的多个datatable导入到一个excel的多个sheet中
- 导出Excel 把一个dataset的多个datatable导入到一个excel的多个sheet中
- 导出DataSet数据到excel的多个sheet
- POI导出数据到Excel的多个Sheet
- 大于65535的数据GridView导出Excel压缩包
- 导出多个sheet的Excel以及在服务器上压缩文件然后再导出(在这里是压缩一个excel后导出)
- C# 如何将 不同的数据(多个查询结果集 dataset)导出到一个excel的不同sheet中
- DataSet中多表导出到同一Excel的不同sheet中
- excel统计另外一个sheet的筛选数据
- C#线程的基本应用(数据导出,与数据转移)
- 修改、插入textarea值
- linux笔试题参考答案(2)
- 回调函数的C++ 封装(非静态成员函数的回调函数实现方法)
- 二叉树的深度优先遍历、广度优先遍历和非递归遍历
- 在Excel的一个sheet中导出大于20万的数据
- 在debian lenny中用vi 做为crontab 的编辑器
- linux笔试题参考答案(3)
- 配置sqlserver 使不能远程访问
- 设计模式21——Interpreter设计模式
- SQLServer数据库的锁类型总结
- Mercurial Queues (MQ) <二>
- MFC 自定义消息
- python访问PostgreSQL数据库之连接库Psycopg2