序号 对端号码   通话类型 呼叫时间      时长 话费
1    2968900566 市话费   2007-8-1 8:45 176  0.2xls文件里的数据同上 有很多条请教高手将所有数据筛选出来,条件是时间要<8:15 并且>17:45 时长>600s不能用组键,用流读取。

解决方案 »

  1.   

    用JExcelAPI
    try {
    workbook = Workbook.getWorkbook(xlsFile);
    } catch (BiffException ex) {
    ex.printStackTrace();
    } catch (IOException ex) {
    ex.printStackTrace();
    }
    Sheet sheet = workbook.getSheet(0); //打开第一个sheet
    int rows = sheet.getRows(); //返回表格行数
    System.out.println("共"+rows+"行");
    int counter = 0, sucess = 0;
    Cell currentCell = null;
    boolean hasError = false;
    for(int i=1; i<rows; i++){
    //操作excel中的数据
    currentCell = sheet.getCell(3,i);
    Date 呼叫时间 = new java.sql.Date( ((DateCell)currentCell).getDate().getTime() );
    currentCell = sheet.getCell(4,i); //TOTAL_LANES
    int 时长 = (int)((NumberCell)currentCell).getValue();
    if(时间要<8:15 并且>17:45 时长>600s){
    //打印记录
    }
    }
    workbook.close();
      

  2.   

    注:xlsFile可以是文件,可以是inputStream