Using Apache POI Open source package for Excel Reading

Source: Internet
Author: User

Considering backwards compatibility and standardization issues, we use the Open Source Tool Apache POI for Excel Reading
When the POI reads, the contents of the cell are considered double, which is not the same as the default string for JXL.
Example code: Https://github.com/tonylee0329/java_lab/blob/master/src/main/java/org/tony/file/ReadExcel.java

Problems encountered in 1. POI reading scientific notation, you can use NumberFormat to format the data. Whether the thousand separator is used: setgroupingused () Reference code
BigDecimal num = new BigDecimal (Cell.getnumericcellvalue ()); NumberFormat format = Numberformat.getinstance (); format.setmaximumfractiondigits (2); format.setgroupingused (false) ; celldata = Format.format (num);

2.POI recognition of dates is also relatively weak, so the format is requiredNewSimpleDateFormat( "yyyy-mm-dd" ).Format (Dateutil.getjavadate (Cell.Getnumericcellvalue ()));
detailed reference to the code on GitHub

Use Apache POI Open source package for Excel reading

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.