一般是因为cell里边的值为数字导致,有时变成文本格式还是解决不了这个问题.  
下边的代码是c# 改变设置cell类型的方法 是用这个参数 CellType.String

 

Row.GetCell((int)customer_level_index).SetCellType(CellType.String);
detail.customer_level = Row.GetCell((int)customer_level_index).StringCellValue;


这个下边是网上的

POI 实际上setCellValue的时候根据传入参数的类型会自动设置celltype,所以
long vll = Long.valueOf(vls.trim()); //sheet.getRow(i).getCell(j).setCellType(Cell.CELL_TYPE_NUMERIC); 要mark掉,否则有异常 sheet.getRow(i).getCell(j).setCellValue(vll);

 

posted on 2018-05-24 16:41  小石头的一天  阅读(11384)  评论(0编辑  收藏  举报