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