[英]The method getSheetAt(int) from the type XSSFWorkbook refers to the missing type XSSFSheet
I have imported all jar files of apache poi in the project build path, but im still getting error "The method getSheetAt(int) from the type XSSFWorkbook refers to the missing type XSSFSheet".我已经在项目构建路径中导入了 apache poi 的所有 jar 文件,但我仍然收到错误“来自 XSSFWorkbook 类型的方法 getSheetAt(int) 指的是缺少的类型 XSSFSheet”。 ' '
Im using version- poi-bin-4.1.2-20200217我正在使用版本- poi-bin-4.1.2-20200217
Code:代码:
ackage ReadExcelData;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ReadExcel {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File src = new File("C:\\Users\\Vishwa\\Desktop\\DeskTop\\Projects\\Automation Projects\\TestData.xlsx");
FileInputStream fis = new FileInputStream(src);
XSSFWorkbook wb = new XSSFWorkbook(fis);
wb.getSheetAt(0); //Error here: The method getSheetAt(int) from the type XSSFWorkbook refers to
the missing type XSSFSheet ,
The type org.apache.poi.xssf.usermodel.XSSFSheet cannot be resolved. It is indirectly referenced from required .class files
}
Do you have你有
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
In your pom.xml if you are using maven?如果您使用的是 maven,在您的 pom.xml 中?
Or add this jar f you have a lib或者添加这个 jar 如果你有一个库
https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/4.1.2/ . https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/4.1.2/ 。
poi-ooxml-4.1.2.jar poi-ooxml-4.1.2.jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.