Apache poi fails with "The document is really a XML file"

Viewed 40

I am trying to open a .doc file (97-2003) with apache library, however I get an error "The document is really a XML file".

private String getStringFromDoc(@NonNull File docFile) {
    String stringDoc = "";
    try (InputStream fileInputStream = new FileInputStream(docFile)) {
        WordExtractor extractor = new WordExtractor(fileInputStream);
        stringDoc = extractor.getText();
        AkitaScenario.getInstance().getScenario().write(stringDoc);
        log.info("DOC document parsed");
    } catch (Exception e) {
        log.error(e);
    }
    return stringDoc;
}

Is there a way to handle it?

0 Answers
Related