0
以下是我用於從Excel表格中提取任何值的代碼。單元格值可以是字符串,日期或長整型。使用下面的代碼,我可以正確提取字符串和日期,但長整型值將作爲4.6861230317E10而不是46861230317.如何解決此問題?如何使用硒從Excel表格中提取雙int值
Cell = ExcelWSheet.getRow(RowNum).getCell(ColNum);
if(Cell.getCellTypeEnum() == CellType.STRING)
{
System.out.println("check for celltype string");
CellData = Cell.getStringCellValue();
System.out.println("String CellData:"+CellData);
}
else
if(Cell.getCellTypeEnum() == CellType.NUMERIC)
{
System.out.println("checking for celltype numeric");
CellData = fmt.formatCellValue(Cell);
if(CellData.contains("/"))
{
System.out.println("its a date !"+CellData);
}
else if(!CellData.contains("/"))
{
double CellData2 = (double)Cell.getNumericCellValue();
System.out.println("actual double value "+CellData2);
CellData=String.valueOf(CellData2);
System.out.println("its a double int numeric value "+CellData);
}
}
System.out.println("returning cell data "+CellData);
return CellData;