Cannot import XSSF in Apache POI

后端 未结 11 638
无人及你
无人及你 2020-11-29 01:59

I am referencing the version 3.7 of the Apache POI and I am getting a \"cannot be resolved\" error when I do:

import org.apache.poi.xssf.usermodel.XSSFWorkbo         


        
11条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 02:57

    I Got the Solution Guys

    You need to keep some points in your mind .

    1. There are two different dependency one is (poi) & other dependency is (poi- ooxml) but make sure you must use poi-ooxml dependency in your code.

    2. Just Add the following dependency in pom.xml & Save it.

    
      org.apache.poi
      poi-ooxml
      3.9
      
    

    3 .After you have saved the pom.xml then you need to try a small thing ,Use (.) operator will try to import/fetch it & finally will not see any sort of error because now it has imported that thing in your package.

    Sample Code to Understand Better !!

    package ReadFile;// package   
    import org.apache.poi.xssf.usermodel.XSSFWorkbook;  // automatically added to your code after importing
    public class Test          
    {  
    public static void Hello() // Method  
    {  
    XSSFWorkbook workbook = new XSSFWorkbook();   
    }  
    }
    

    I tried my best to give you the solution , If you face any issue comment here i will try
    to solve it .

    Keep Learning Guys !!

提交回复
热议问题