Java solution for large files in excel-xlsx format

Source: Internet
Author: User

1, the first time to read about 7M ecxel files, using the POI Library implementation, reference to the following blog post.

Http://www.cnblogs.com/chenfool/p/3632642.html

Using the above method in the following workbookfactory.create () there will be a memory overflow error, adjust eclipse parameters to-xmx3072m, this error will still occur.

FIS = new FileInputStream (file);  

It should be because the above method uses the DOM parsing mode, using streaming to parse large files without a memory overflow problem.

2, after Google, found the following post:
http://www.iteye.com/topic/624969
The excel2007 file format differs from the previous version by using Microsoft's own storage format. The 07 version of the content is stored in XML format, so, of course, the reading of the large data volume of xlsx file is also the XML processing method of Sax.

Using the method above, the
XMLReader parser = Xmlreaderfactory.createxmlreader ("Org.apache.xerces.parsers.SAXParser");
This sentence will appear
Java.lang.ClassNotFoundException:org.apache.xerces.parsers.SAXParser's error.
download your own xerces.jar file and it will appear when you load

Java.lang.AbstractMethodError:org.apache.xerces.dom.ElementImpl.getTextContent () ljava/lang/string error.

It seems that we can only find other ways.

3, after some Google, found the following link

Https://blogs.oracle.com/mei/entry/java_lang_classnotfoundexception_org_apache
Follow The instructions in the link above to resolve the issue by changing the code that generates XMLReader to the following method.
1 NULL ; 2 //  3//4 m_parserfactory =5 m_ Parserfactory.setnamespaceaware (true); 6 7 XMLReader parser = M_parserfactory.newsaxparser (). Getxmlreader ();

Appendix: The following links are provided throughout the process:

Java reads Excel. xlsx file POI implementation tested around 7M files no problem

Http://www.cnblogs.com/chenfool/p/3632642.html

Large data volume of the Excel file read--excel2007 (including code and samples) tested around 36M file no problem, you need to follow the above to modify the slightly.

http://www.iteye.com/topic/624969

Java.lang.AbstractMethodError:org.apache.xerces.dom.ElementImpl.getTextContent () ljava/lang/string Xerces the correct reason for causing this error is described

Http://stackoverflow.com/questions/14014989/java-lang-abstractmethoderror-org-apache-xerces-dom-elementimpl-gettextcontent

Java.lang.ClassNotFoundException:org.apache.xerces.parsers.SAXParser does not use the Xerces.jar solution

Https://blogs.oracle.com/mei/entry/java_lang_classnotfoundexception_org_apache

Java solutions for large files with excel-xlsx format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.