when you use Java to read excel, the decimal is automatically converted to an imprecise decimal point.
read the code of excel
public static List<String[]> readExcel(File file) throws Exception {
//
List<String[]> dataList = new ArrayList<String[]>();
//Workbook
Workbook workbook = getWorkBook(file);
if (workbook == null)
throw new Exception("excelworkbook build null");
for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNumPP) {
//sheet
Sheet sheet = workbook.getSheetAt(sheetNum);
if (sheet == null)
continue;
if (sheet.getNumMergedRegions() > 0)
setSheetMergedRegionsValue(sheet);
//sheet
int firstRowNum = sheet.getFirstRowNum();
//sheet
int lastRowNum = sheet.getLastRowNum();
//
for (int rowNum = firstRowNum; rowNum <= lastRowNum; rowNumPP) {
//
Row row = sheet.getRow(rowNum);
if (row == null)
continue;
//
int firstCellNum = row.getFirstCellNum();
//
int lastCellNum = row.getPhysicalNumberOfCells();
String[] cells = new String[row.getPhysicalNumberOfCells()];
//
for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNumPP) {
if (cellNum < 0)
continue;
Cell cell = row.getCell(cellNum);
if (cell == null)
continue;
cell.setCellType(Cell.CELL_TYPE_STRING);
cells[cellNum] = cell.getStringCellValue();
}
// continue
if (cells.length > 0 && StringUtils.isBlank(cells[0]))
continue;
dataList.add(cells);
}
}
//workbook.close();
return dataList;
}
excel raw file
how to solve this problem?