Using Apache POI to read Excel numbers is a matter of scientific counting method

Source: Internet
Author: User

Yesterday, the boss gave me an Excel file called me to send the contents of the message to send (2 fields, mobile phone number and content), and then I wrote a method with Apache inside the POI read, found that the mobile phone number is scientific counting method, after the understanding found whether the number is a decimal, When you use Cell.getnumbericcellvalue () to get a value, you get a double, and it becomes a scientific notation when the length is larger. Then getting the original data of this cell is actually a question of how a double is converted into an integer. We can use DecimalFormat to convert this double to get the value we want.

DecimalFormat df = new DecimalFormat ("0"); String val = Df.format (Cell.getnumericcellvalue ());


This article is from the "thick Product Thin Hair" blog, please make sure to keep this source http://564029287.blog.51cto.com/4516433/1588219

Using Apache POI to read Excel numbers is a matter of scientific counting method

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.