Use POI to read the Excel file and read the phone number into 1.3471022771E10

Source: Internet
Author: User

use POI to read the Excel file and read the phone number into 1.3471022771E10 [problem points: 40 points, knot person Xieyongqiu]Do not show delete repliesShow All repliesShow star replyShow score ReplyOnly show landlordCollection
concern
Xie Yongqiu
maobingxixi
version level: 
Knot rate: 71.43%
landlord posted: 2010-09-13 17:33:03   Read poi  using  excel   file, read phone number   turn   1.3471022771E10    how   fix? more 2 Share to:
Useful to me [0] throw a brick [0] reference | Report | Management number of replies:
concern
Eemean
Eemean
This edition level:
#1 Score: 5 replies.: 2010-09-13 17:34:34 You have to judge more, CELL type seems to have four types,
Useful to me [0] throw a brick [0] reference | Report | Management
concern
Xieyongqiu
Maobingxixi
This edition level:
#2 Score: 0 replies.: 2010-09-13 17:41:35
if (cell.getcelltype () = = Hssfcell.cell_type_numeric) {


DateFormat format = new SimpleDateFormat (DATEUTIL.YYYY_MM_DD);


if (hssfdateutil.iscelldateformatted (cell)) {
is a date type
str = Format.format (Cell.getdatecellvalue ());
} else {
Whether it is a numeric type
Double d = cell.getnumericcellvalue ();
if (d-(int) d < double.min_value) {
is an int type
str = integer.tostring ((int) d);
} else {
System.out.println ("Double ...");
is a double type
str = double.tostring (Cell.getnumericcellvalue ());
}
}

System.out.println ("type==" +cell.getcelltype ());
System.out.println ("cell==" +str);


}else if (cell.getcelltype () = = hssfcell.cell_type_string) {
str = Cell.getrichstringcellvalue (). getString ();
}else if (cell.getcelltype () = = Hssfcell.cell_type_formula) {
str = Cell.getcellformula ();
}else if (cell.getcelltype () = = Hssfcell.cell_type_blank) {
str = "";
}else if (cell.getcelltype () = = Hssfcell.cell_type_error) {
str = "";
}




These types are judged, still 1.3471022771E10.





Useful to me [0] throw a brick [1] reference | Report | Management
concern
Xieyongqiu
Maobingxixi
This edition level:
#3 Score: 0 replies.: 2010-09-13 17:51:55 solved is a conversion problem


Converting a mobile number that is represented as 1.3922433397E10 to 13922433397 is not necessarily the best way to convert
DecimalFormat df = new DecimalFormat ("#");

System.out.println ("type666==" +df.format (Cell.getnumericcellvalue ()));

Use POI to read the Excel file and read the phone number into 1.3471022771E10

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.