EasyPoi踩坑记录


Exception in thread “main” com.alibaba.excel.exception.ExcelCommonException: Convert excel format exception.You can try specifying the ‘excelType’ yourself

    ExcelReader build1 = EasyExcel.read("src/test/resources/单Sheet.xlsx").build();

    ExcelReader build2 = EasyExcel.read("src/test/resources/多Sheet.xlsx").build();


    ![alt text](image.png)

    ExcelReader build1 = EasyExcel.read("src/test/resources/单Sheet.xlsx").excelType(ExcelTypeEnum.XLSX).build();

Exception in thread “main” com.alibaba.excel.exception.ExcelAnalysisException: java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.atWarn()Lorg/apache/logging/log4j/LogBuilder;

    ![alt text](image-1.png)


    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.17.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.17.2</version>
    </dependency>

====
Exception in thread “main” org.apache.poi.openxml4j.exceptions.OLE2NotOfficeXmlFileException: The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (eg HSSF instead of XSSF)

doc 的版本

====

Exception in thread “main” java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder;

Exception in thread “main” java.lang.ClassCastException: org.apache.poi.xwpf.usermodel.XWPFDocument cannot be cast to cn.afterturn.easypoi.word.entity.MyXWPFDocument

    XWPFDocument doc = new MyXWPFDocument(Files.newInputStream(new File("/Users/chenshang/Work/Seed/Server/service/src/main/resources/input.docx").toPath()));

评论