Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.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 我正在尝试将一张工作表的第一行与另一张工作表的第一行进行匹配,并检索匹配的数据_Java_Excel_Apache Poi - Fatal编程技术网

Java 我正在尝试将一张工作表的第一行与另一张工作表的第一行进行匹配,并检索匹配的数据

Java 我正在尝试将一张工作表的第一行与另一张工作表的第一行进行匹配,并检索匹配的数据,java,excel,apache-poi,Java,Excel,Apache Poi,我正在尝试将一个工作表的第一行与另一个工作表的第一行匹配,并检索另一个工作表的其余数据 sheet=workbook.getSheetAt(1); rowCount=sheet.getPhysicalNumberOfRows(); for (int x=0; x<rowCount; x++) { System.out.println(sheet.getRow(x).getCell(0).getStringCellValue());//--------

我正在尝试将一个工作表的第一行与另一个工作表的第一行匹配,并检索另一个工作表的其余数据

    sheet=workbook.getSheetAt(1);
    rowCount=sheet.getPhysicalNumberOfRows();
    for (int x=0; x<rowCount; x++) {
        System.out.println(sheet.getRow(x).getCell(0).getStringCellValue());//------------
        if (li.get(x).equalsIgnoreCase(sheet.getRow(x).getCell(0).getStringCellValue())) {
            //retrieve the data of matching row
        }
我已经像这样存储了列表中第一行的数据

    int rowCount=sheet.getPhysicalNumberOfRows();
    List<String> li=new ArrayList<String>();
    for (int x=0; x<rowCount; x++) {
        li.add(sheet.getRow(x).getCell(0).getStringCellValue());
    }
int rowCount=sheet.getPhysicalNumberOfRows();
List li=new ArrayList();

对于(int x=0;x,我在上一个代码块中看到两个问题:


  • x是的,存在等式
    
        for (int y=0; y<rowCount; y++) {
                System.out.println(li.get(y));
                for (int z=0; z<rowCount; z++) {
                    if (li.get(y).equalsIgnoreCase(sheet.getRow(z).getCell(0).getStringCellValue())) {
                        XSSFRow row=sheet.getRow(z);
                        for (int x=1; x<=row.getLastCellNum(); x++) {
                            System.out.println(row.getCell(x).getStringCellValue());
                            System.out.println("found");
    //                      break;
                        }
                    }
    
                }
            }