OutExcel2007 v1.0.0 发布
?
这个只是个测试版本...目前该版本.支持多sheet100W数据量的数据导出.
?
解决了Excel2007的格式导出大数据量内存溢出问题 ,
?
本工具,绝对不会出现内存溢出的问题,即使每个sheet100W数据量.导出100个这样sheet ,(100W*100 的数据量)
?
希望大家.有BUG就提..有不好的地方就说啊...
?
?
package com.asc.excel;import java.io.File;import java.io.FileOutputStream;import java.io.OutputStream;import java.text.SimpleDateFormat;import java.util.Date;import com.asc.excel.util.SpreadSheet;import com.asc.excel.xlsx.XlsxWorkbook;public class WorkTest {public static void main(String[] args) throws Exception {long start = System.currentTimeMillis();create();for(int i = 0 ; i < 10; i++){append();}long end = System.currentTimeMillis();System.out.println(new SimpleDateFormat("mm:ss.SSS").format(new Date(end - start)));}public static void append() throws Exception{Workbook wb = new XlsxWorkbook(new File("D:/Temp/tmp.xlsx"));Sheet sht1 = wb.getSheet("第一制药");int start = sht1.getLastRowSum() +1;SpreadSheet sp2 = sht1.getSpreadSheet();for(int i = start ; i < (start + 10); i ++){sp2.insertRow(i);sp2.createCell(0, "你好---" + i + "!");sp2.createCell(1, (double)232987+i);sp2.createCell(2, "我很好..你好吗---" + i + "!");sp2.createCell(3, (double)232987+i);sp2.createCell(4, "12345---" + i + "!");sp2.createCell(5, (double)232987+i);sp2.createCell(6, "12345---" + i + "!");sp2.createCell(7, (double)232987+i);sp2.endRow();}Sheet sht2 = wb.getSheet("中美1");if(sht2 == null){sht2 = wb.createSheet("中美1"); }SpreadSheet sp = sht2.getSpreadSheet();int start2 = sht2.getLastRowSum();for(int i = start2 ; i < (start2 + 10); i ++){sp.insertRow(i);sp.createCell(0, "你好---" + i + "!");sp.createCell(1, (double)232987+i);sp.createCell(2, "我很好..你好吗---" + i + "!");sp.createCell(3, (double)232987+i);sp.createCell(4, "12345---" + i + "!");sp.createCell(5, (double)232987+i);sp.createCell(6, "12345---" + i + "!");sp.createCell(7, (double)232987+i);sp.endRow();}wb.write();}public static void create() throws Exception{Workbook wb = new XlsxWorkbook();Sheet st1 = wb.createSheet("第一制药");Sheet st2 = wb.createSheet("中美");SpreadSheet sp = st1.getSpreadSheet();for(int i = 1 ; i < 5; i ++){sp.insertRow(i);sp.createCell(0, "你好---" + i + "!");sp.createCell(1, (double)232987+i);sp.createCell(2, "12345---" + i + "!");sp.createCell(3, (double)232987+i);sp.createCell(4, "12345---" + i + "!");sp.createCell(5, (double)232987+i);sp.createCell(6, "12345---" + i + "!");sp.createCell(7, (double)232987+i);sp.endRow();}SpreadSheet sp2 = st2.getSpreadSheet();for(int i = 1 ; i < 10; i ++){sp2.insertRow(i);sp2.createCell(0, "你好---" + i + "!");sp2.createCell(1, (double)232987+i);sp2.createCell(2, "我很好..你好吗---" + i + "!");sp2.createCell(3, (double)232987+i);sp2.createCell(4, "12345---" + i + "!");sp2.createCell(5, (double)232987+i);sp2.createCell(6, "12345---" + i + "!");sp2.createCell(7, (double)232987+i);sp2.endRow();}OutputStream os = new FileOutputStream(new File("D:/Temp/tmp.xlsx"));wb.write(os);}}QQ : 277215237版本已经更新,比如在你的create中再增加一些代码如下: