Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用ApachePOI在excel中基于多列值查找数据_Java_Excel_Maven_Apache Poi - Fatal编程技术网

Java 如何使用ApachePOI在excel中基于多列值查找数据

Java 如何使用ApachePOI在excel中基于多列值查找数据,java,excel,maven,apache-poi,Java,Excel,Maven,Apache Poi,我使用ApachePOI通过java将值读取和写入excel文件。我有下面的excel文件,我需要从该文件中获取符合我要求标准的数据 应用 酪蛋白 FeeType 评论 阿帕 1234 安全 添加评论 AppB 1235 其他 案例创建 阿帕 1236 安全 补充评论 你能像下面这样说吗 Iterator<Row> rows = sheet.rowIterator(); while(rows.hasNext()) { Row row = rows.next(); St

我使用ApachePOI通过java将值读取和写入excel文件。我有下面的excel文件,我需要从该文件中获取符合我要求标准的数据

应用 酪蛋白 FeeType 评论 阿帕 1234 安全 添加评论 AppB 1235 其他 案例创建 阿帕 1236 安全 补充评论
你能像下面这样说吗

Iterator<Row> rows = sheet.rowIterator();
while(rows.hasNext()) {
    Row row = rows.next();
    String app = row.getCell(0).getRichStringCellValue().getString();
    String feeType = row.getCell(2).getRichStringCellValue().getString();
    String comment = row.getCell(3).getRichStringCellValue().getString();
    
    if(app.equals("AppA") && feeType.equals("Security") && comment.equals("Add Comments")) {
        //Here is your condition satisfied
    }
}
Iterator rows=sheet.rowditerator();
while(rows.hasNext()){
Row=rows.next();
String app=row.getCell(0.getRichStringCellValue().getString();
String feeType=row.getCell(2.getRichStringCellValue().getString();
String comment=row.getCell(3.getRichStringCellValue().getString();
if(app.equals(“AppA”)&&feeType.equals(“安全”)&&comment.equals(“添加注释”)){
//这是您满意的条件
}
}

这很有效,谢谢。