91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 13.11MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2024-01-31
  • 語言: Java
  • 標簽: excel??大文件??xlsx??

資源簡介

文件里包含可以運行起來的項目,下載下來解壓后,引入項目就可以運行看結果了。該代碼可以處理100萬數據量的excel文件,xlsx文件數據量太大,用普通的讀法會報內存溢出錯誤,所以用官網提供的方法,一條一條的讀取大excel文件,本例子從這點出發,組裝excel里讀取的單條數據為list,在根據需求操作list,即單條讀取,單條操作,下載下來 后找到endRow(int rowNum)函數,在函數末尾有個注銷的list數組打印,這個list即從excel里讀取的當前行,列順序同excel里的列順序,直接操作list即可。

資源截圖

代碼片段和文件信息

package?cn.com.poi.utils;
?
?
import?java.io.File;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.PrintStream;
import?java.util.ArrayList;
import?java.util.List;

import?javax.xml.parsers.ParserConfigurationException;

import?org.apache.poi.openxml4j.exceptions.Openxml4JException;
import?org.apache.poi.openxml4j.opc.OPCPackage;
import?org.apache.poi.openxml4j.opc.PackageAccess;
import?org.apache.poi.ss.usermodel.DataFormatter;
import?org.apache.poi.ss.util.CellAddress;
import?org.apache.poi.ss.util.CellReference;
import?org.apache.poi.util.SAXHelper;
import?org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
import?org.apache.poi.xssf.eventusermodel.XSSFReader;
import?org.apache.poi.xssf.eventusermodel.XSSFSheetxmlHandler;
import?org.apache.poi.xssf.eventusermodel.XSSFSheetxmlHandler.SheetContentsHandler;
import?org.apache.poi.xssf.extractor.XSSFEventbasedExcelExtractor;
import?org.apache.poi.xssf.model.stylesTable;
import?org.apache.poi.xssf.usermodel.XSSFComment;
import?org.xml.sax.ContentHandler;
import?org.xml.sax.InputSource;
import?org.xml.sax.SAXException;
import?org.xml.sax.xmlReader;
?
/**
?*?A?rudimentary?XLSX?->?CSV?processor?modeled?on?the
?*?POI?sample?program?XLS2CSVmra?from?the?package
?*?org.apache.poi.hssf.eventusermodel.examples.
?*?As?with?the?HSSF?version?this?tries?to?spot?missing
?*?rows?and?cells?and?output?empty?entries?for?them.
?*?


?*?Data?sheets?are?read?using?a?SAX?parser?to?keep?the
?*?memory?footprint?relatively?small?so?this?should?be
?*?able?to?read?enormous?workbooks.??The?styles?table?and
?*?the?shared-string?table?must?be?kept?in?memory.??The
?*?standard?POI?styles?table?class?is?used?but?a?custom
?*?(read-only)?class?is?used?for?the?shared?string?table
?*?because?the?standard?POI?SharedStringsTable?grows?very
?*?quickly?with?the?number?of?unique?strings.
?*?


?*?For?a?more?advanced?implementation?of?SAX?event?parsing
?*?of?XLSX?files?see?{@link?XSSFEventbasedExcelExtractor}
?*?and?{@link?XSSFSheetxmlHandler}.?Note?that?for?many?cases
?*?it?may?be?possible?to?simply?use?those?with?a?custom
?*?{@link?SheetContentsHandler}?and?no?SAX?code?needed?of
?*?your?own!
?*/
public?class?XLSX2CSV?{
????/**
?????*?Uses?the?XSSF?Event?SAX?helpers?to?do?most?of?the?work
?????*?of?parsing?the?Sheet?xml?and?outputs?the?contents
?????*?as?a?(basic)?CSV.
?????*/
????private?class?SheetConvert?implements?SheetContentsHandler?{
????????private?boolean?firstCellOfRow?=?false;
????????private?int?currentRow?=?-1;
????????private?int?currentCol?=?-1;
????????private?List?lineArray?=?new?ArrayList();
?
????????private?void?outputMissingRows(int?number)?{
????????????for?(int?i?=?0;?i?????????????????for?(int?j?=?0;?j?????????????????????output.append(‘‘);
????????????????}
????????????????output.append(‘\n‘);
????????????}
????????}
?
????????@Override
???????


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????1120??2018-07-06?16:33??testpoi\.classpath

?????文件????????383??2018-07-12?11:38??testpoi\.project

?????文件????????629??2018-07-06?16:32??testpoi\.settings\org.eclipse.jdt.core.prefs

?????文件???????3253??2018-07-12?11:40??testpoi\bin\cn\com\poi\utils\XLSX2CSV$SheetConvert.class

?????文件???????5611??2018-07-12?11:40??testpoi\bin\cn\com\poi\utils\XLSX2CSV.class

?????文件?????284184??2018-07-06?16:33??testpoi\lib\commons-codec-1.10.jar

?????文件?????751238??2018-07-06?16:33??testpoi\lib\commons-collections4-4.1.jar

?????文件??????61829??2018-07-06?16:33??testpoi\lib\commons-logging-1.2.jar

?????文件??????98365??2018-07-06?16:32??testpoi\lib\curvesapi-1.04.jar

?????文件?????314932??2018-07-06?16:33??testpoi\lib\junit-4.12.jar

?????文件?????489884??2018-07-06?16:33??testpoi\lib\log4j-1.2.17.jar

?????文件????2679259??2018-07-06?16:32??testpoi\lib\poi-3.16.jar

?????文件?????369786??2018-07-06?16:32??testpoi\lib\poi-examples-3.16.jar

?????文件??????31218??2018-07-06?16:32??testpoi\lib\poi-excelant-3.16.jar

?????文件????1433719??2018-07-06?16:32??testpoi\lib\poi-ooxml-3.16.jar

?????文件????5871746??2018-07-06?16:32??testpoi\lib\poi-ooxml-schemas-3.16.jar

?????文件????1384931??2018-07-06?16:32??testpoi\lib\poi-scratchpad-3.16.jar

?????文件????2730866??2018-07-06?16:32??testpoi\lib\xmlbeans-2.6.0.jar

?????文件???????9160??2018-07-12?11:40??testpoi\src\cn\com\poi\utils\XLSX2CSV.java

?????目錄??????????0??2018-07-12?11:39??testpoi\bin\cn\com\poi\utils

?????目錄??????????0??2018-07-12?11:39??testpoi\src\cn\com\poi\utils

?????目錄??????????0??2018-07-12?11:39??testpoi\bin\cn\com\poi

?????目錄??????????0??2018-07-12?11:39??testpoi\src\cn\com\poi

?????目錄??????????0??2018-07-12?11:39??testpoi\bin\cn\com

?????目錄??????????0??2018-07-12?11:39??testpoi\src\cn\com

?????目錄??????????0??2018-07-12?11:38??testpoi\bin\cn

?????目錄??????????0??2018-07-12?11:38??testpoi\src\cn

?????目錄??????????0??2018-07-12?11:38??testpoi\.settings

?????目錄??????????0??2018-07-12?11:39??testpoi\bin

?????目錄??????????0??2018-07-12?11:38??testpoi\lib

............此處省略5個文件信息

評論

共有 條評論