jxl读取Excel时 读到空单元格的时候就报错 
jxl.read.biff.BlankCellelse if(cell.getType()==CellType.EMPTY){
    EmptyCell ec = (EmptyCell)cell;
    return ec.getContents();

解决方案 »

  1.   

    加判断
     
    if (cell.getType() == CellType.EMPTY)   
            {   
                 
                if(null != 从excel里取出的值)   
                {   
                 在执行你的操作          
                 } 
             }
      

  2.   

    public Object readCell(Cell cell){
       if(cell.getType()==CellType.NUMBER){
        NumberCell nc=(NumberCell)cell;
        return nc.getValue();
       }else if(cell.getType()==CellType.LABEL){
        LabelCell cl = (LabelCell)cell;
        return cl.getString();
       }else if(cell.getType()==CellType.EMPTY){
        EmptyCell ec = (EmptyCell)cell;
        return ec.getContents();
       }else if(cell.getType()==CellType.DATE){
        DateCell dc = (DateCell)cell;
        java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd");
             String s = format1.format(dc.getDate());
             return s;
       }else if(cell.getType()==CellType.BOOLEAN){
        BooleanCell bc = (BooleanCell)cell;
        return bc.getValue();
       }else if(cell.getType()==CellType.NUMBER_FORMULA){
        NumberFormulaCell nfc = (NumberFormulaCell)cell;
          DecimalFormat df = new DecimalFormat("#######0.00");
          return df.format(nfc.getValue());
       }else if(cell.getType()==CellType.DATE_FORMULA){
        DateFormulaCell dfc = (DateFormulaCell)cell;
        java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd");
             String s = format1.format(dfc.getDate());
             return s;
       }else{
        return cell.getContents();
       }
    }
      

  3.   

    for(int x = 0; x<23;x++)
    {
    String strS = "";
    for(int i = 0; i<objSheet.getColumns();i++)
    {
    objCell = objSheet.getCell(i, x);
    int as = objCell.getRow();
    int ass = objCell.getColumn();
    System.out.println("hang"+as);
    System.out.println("lie"+ass);
    Object Strs = this.readCell(objCell);
    System.out.print("第"+x+"行,第"+i+"列的值==="+Strs+"\n");
    }

    }
      

  4.   

    当 strs 是空的时候就报错