我用了POI读取excel单元格值和相应的批注,但显示出来的结果不对应,难道是循环出现问题,请问下哪个地方的问题private String readformula(Cell cell){
  try{
    return df.format(cell.getNumericCellValue());
  }catch(Exception e){
  return "";
  }
}    //读取有标注的单元格的字符串及相应标注
 //@param filepath 文件路径
public void readDataFromExcel(String filepath){
     String Strcell="";
     String comment = "";
     Sheet sheet=null;
     try{
       InputStream is = new FileInputStream(filepath);
       //根据输入流创建Workbook对象
       Workbook wb = WorkbookFactory.create(is);
       //get到Sheet对象
       int numsheet = wb.getNumberOfSheets();
       for (int a = 0; a < numsheet; a++) { //循环表格
         sheet = wb.getSheetAt(a);
//这个必须用接口
         for (Row row : sheet) {
           for (Cell cell : row) {
             if (cell.getCellComment() != null ) {
               Strcell = "";
               comment = "";
              
               //cell.getCellType是获得cell里面保存的值的type
               //如Cell.CELL_TYPE_STRING
               switch (cell.getCellType()) {
                 case Cell.CELL_TYPE_BOOLEAN:                   //得到Boolean对象的方法
                   //cell.getBooleanCellValue();
                   break;
                 case Cell.CELL_TYPE_FORMULA:                   //读取公式
                   Strcell = readformula(cell);
                   break;
                 case Cell.CELL_TYPE_STRING:                   //读取String
                   Strcell = cell.getRichStringCellValue().toString();
                   break;
               }
               celllist.add(Strcell);
               comment = cell.getCellComment().getString().toString();
               commentlist.add(comment);
               addresslist.add(filepath);
               System.out.println(Strcell+","+comment);
             }
           }         }       }
     }
     catch(Exception e){}
}
结果:
127.200,winse:
#年2009#月12#日31#编程@分
9.235,winse:
#年2009#月12#日31#编程@分
31.800,winse:
#年2010#月12#日31#编程@收入excel中是:
127.200
winse:
#年2009#月12#日31#编程@分
31.800
winse:
#年2009#月12#日31#编程@分
9.235
winse:
#年2010#月12#日31#编程@收入