简体   繁体   English

来自 XSSFWorkbook 类型的方法 getSheetAt(int) 指的是缺少的类型 XSSFSheet

[英]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.

相关问题 类型BaseAction的方法getRequest()引用缺少的类型HttpServletRequest - The method getRequest() from the type BaseAction refers to the missing type HttpServletRequest 类型 ResponseBodyExtractionOptions 中的方法 jsonPath() 指的是缺少的类型 JsonPath - The method jsonPath() from the type ResponseBodyExtractionOptions refers to the missing type JsonPath 类型已知,但方法指的是缺失的类型 - Type is known, but method refers to missing type logger() slf4j 错误:来自 CoreLogger 类型的方法 logger() 引用了缺少的类型 Logger - logger() slf4j error: The method logger() from the type CoreLogger refers to the missing type Logger IContributionRoot类型中的方法addContributionItem(IContributionItem,Expression)引用缺少的Expression类型 - The method addContributionItem(IContributionItem, Expression) from the type IContributionRoot refers to the missing type Expression Selenium Webdriver错误“ WebElement类型的方法sendKeys(CharSequence…)引用缺少的CharSequence类型” - Selenium Webdriver error “The method sendKeys(CharSequence…) from the type WebElement refers to the missing type CharSequence” 类型不匹配:无法从XSSFSheet转换为HSSFSheet - Type mismatch: cannot convert from XSSFSheet to HSSFSheet 错误“HttpServletRequest引用缺少的类型字符串” - Error “HttpServletRequest refers to the missing type String” XSSFWorkbook,XSSFSheet不起作用-NetBeans 8.0.2 - XSSFWorkbook, XSSFSheet not working - NetBeans 8.0.2 Spring JDBC给出错误:“queryForObject(String,Object [],Class <String> )从类型JdbcTemplate引用缺少的类型DataAccessException“ - Spring JDBC giving error :“queryForObject(String, Object[], Class<String>) from the type JdbcTemplate refers to the missing type DataAccessException ”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM