Use poi to import the Excel file and solve cannot get a text value from a numeric formula Cell

Source: Internet
Author: User

Recent Excel Import

There are two methods: jxl and poi

Problems: jxl import: If a macro exists in the file, an error is reported. The solution cannot be found.

Poi import: memory overflow is caused by a large file size.

Exception in thread "Main" Java. Lang. illegalstateexception: cannot get a text value from a numeric formula Cell

This problem is because the cell uses the "sum function" and the content is not text.

Package cmcc.gz. platform. EMSs. purchase; import Java. io. fileinputstream; import Java. io. ioexception; import Java. io. inputstream; import Org. apache. poi. hssf. usermodel. hssfcell; import Org. apache. poi. hssf. usermodel. hssfrow; import Org. apache. poi. hssf. usermodel. hssfsheet; import Org. apache. poi. hssf. usermodel. hssfworkbook; public class xlsmain {public static void main (string [] ARGs) throws ioexception {Xlsmain = new xlsmain (); xlsmain. readxls ();} private void readxls () throws ioexception {inputstream is = new fileinputstream ("f :\\ import template v1.1.xls"); hssfworkbook = new hssfworkbook (is ); // cyclic worksheet sheet for (INT numsheet = 2; numsheet 


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.