import java.io.File; import java.io.FileInputStream;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
公共类TestClass2 {
public static void main(String[] args) {
try{
FileInputStream fis= new FileInputStream(new File("E:\\Garvit\\GarvitDoc.xlsx"));
XSSFWorkbook wb = new XSSFWorkbook(fis);
Sheet s= wb.getSheet("GarvitDoc");
System.out.println(s.getRow(1).getCell(0).getStringCellValue());
System.out.println(s.getRow(1).getCell(1).getStringCellValue());
System.out.println(s.getRow(1).getCell(2).getStringCellValue());
System.out.println(s.getRow(1).getCell(3).getStringCellValue());
System.out.println(s.getRow(1).getCell(4).getStringCellValue());
} catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
当我运行此代码时,它显示'NULL'