资源简介
使用Poi读取大数据量excel的方法
支持2003和2007的版本

代码片段和文件信息
package com.harlan.poi.excelutil;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener;
import org.apache.poi.hssf.eventusermodel.FormatTrackingHSSFListener;
import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
import org.apache.poi.hssf.eventusermodel.HSSFListener;
import org.apache.poi.hssf.eventusermodel.HSSFRequest;
import org.apache.poi.hssf.eventusermodel.MissingRecordAwareHSSFListener;
import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord;
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord;
import org.apache.poi.hssf.model.HSSFFormulaParser;
import org.apache.poi.hssf.record.BOFRecord;
import org.apache.poi.hssf.record.BlankRecord;
import org.apache.poi.hssf.record.BoolErrRecord;
import org.apache.poi.hssf.record.BoundSheetRecord;
import org.apache.poi.hssf.record.FormulaRecord;
import org.apache.poi.hssf.record.LabelRecord;
import org.apache.poi.hssf.record.LabelSSTRecord;
import org.apache.poi.hssf.record.NoteRecord;
import org.apache.poi.hssf.record.NumberRecord;
import org.apache.poi.hssf.record.RKRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.SSTRecord;
import org.apache.poi.hssf.record.StringRecord;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
* Excel-2003行级处理器,ExcelRowProcessor的实现类
* @author zhangchaofeng
* @version 1.0
* @date Sep 28 2011
*/
public abstract class Excel2003RowProcessor implements ExcelRowProcessor{
private MyHSSFListener hssfListener;
private String fileName;
private InputStream is;
private POIFSFileSystem fs;
private int lastRowNumber;
private int lastColumnNumber;
/** Should we output the formula or the value it has? */
private boolean outputFormulaValues = true;
/** For parsing Formulas */
private SheetRecordCollectingListener workbookBuildingListener;
private HSSFWorkbook stubWorkbook;
// Records we pick up as we process
private SSTRecord sstRecord;
private FormatTrackingHSSFListener formatListener;
/** So we known which sheet we‘re on */
private int sheetIndex = -1;
private int optSheetIndex=-1;
private BoundSheetRecord[] orderedBSRs;
private ArrayList boundSheetRecords = new ArrayList();
// For handling formulas with string results
private int nextRow;
private int nextColumn;
private boolean outputNextStringRecord;
private XRow row=new XRow();
/**
* 构造Excel-2003行级解析器
* @param filename excel完整文件名
* @throws IOException
*/
public Excel2003RowProcessor(String filename) throws Exception{
if(filename.endsWith(“.xlsx“)){
throw new Exception(“Excel板式与解析器不匹配,解析器仅支持Excel-2003及以下版本。“);
}
this.fileName=filename;
this.hssfListener=new MyHSS
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-02-09 10:52 HarlanPoi\
文件 662 2015-01-28 17:01 HarlanPoi\.classpath
文件 385 2015-02-09 10:52 HarlanPoi\.project
目录 0 2015-02-09 10:52 HarlanPoi\.settings\
文件 598 2015-01-28 16:23 HarlanPoi\.settings\org.eclipse.jdt.core.prefs
目录 0 2015-02-09 10:52 HarlanPoi\bin\
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\harlan\
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\
文件 8087 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\Excel2003RowProcessor$MyHSSFListener.class
文件 7165 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\Excel2003RowProcessor.class
文件 4767 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\Excel2007RowProcessor$MyHander.class
文件 4576 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\Excel2007RowProcessor.class
文件 1060 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\ExcelProcessor$MyExcel2003RowProcessor.class
文件 1060 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\ExcelProcessor$MyExcel2007RowProcessor.class
文件 1981 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\ExcelProcessor.class
文件 350 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\ExcelRowProcessor.class
文件 1723 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\ReadExcelUtil.class
文件 1366 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\StringUtil.class
文件 957 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\XCell.class
文件 1242 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\excelutil\XRow.class
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\util\
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\util\xls\
文件 8304 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\util\xls\HxlsAbstract.class
文件 5243 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\util\xls\XxlsAbstract.class
目录 0 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\xls\
文件 4248 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\xls\HxlsBig.class
文件 1763 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\xls\HxlsPrint.class
文件 2068 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\xls\Xls2Do.class
文件 3717 2015-02-09 10:52 HarlanPoi\bin\com\harlan\poi\xls\XxlsBig.class
............此处省略30个文件信息
- 上一篇:服务器主板说明书
- 下一篇:《电力系统分析》何仰赞课后习题及答案
相关资源
- AsyncTask文件控制暂停和继续,在状态
- 先进先出库存管理excel表格.rar
- [免费]强大的OFFICE经验(Word Excel)
- ICD10 excel
-
分别适用于.NET fr
amework 2.0和4.0的E - K码和经纬度转换excel表格
- Php 导出数据为EXCEL程序
- 项目周报格式(excel格式报表)
- 一个基于MFC的GridCtrl,提供类似Excel的
- EXCEL横转竖(列转行)宏
- Excel高效办公实例
- 湖南省计算机等级二级考试excel题集锦
- EXCEL文件转换成固定的格式的文本格式
- 从EXCEL中取数据在Teechart7显示应用示例
- New fixed point theorems of e-concave-convex m
- 汉印A300 CPCL协议 android 热敏打印app(
- excel VBA 800(全)
- 易语言Excel多表对应处理源码
- 易语言EXCEL另存为CSV文件源码
- checkpoint的snmp及syslog配置.doc
- Symantec AntiVirus for Microsoft SharePoint产品
- EXCEL函数手册.chm格式
- Excel修复精灵中文免费版2009
- DataNumen Excel Repair Excel文件修复工具
- vue实现导出Excel的两个js文件-Blob+Exp
- Blob.js+Export2Excel.js
- LibXL for Windows 3.8.3 最新版Excel操作库带
- EXCEL 甘特图模板
- 项目开发计划与跟踪汇总表模板
- 中文版excel2007 图表宝典(光盘附件)
评论
共有 条评论