使用Java阅读MS Word 2007

使用Java阅读MS Word 2007,java,Java,我正在尝试通过Java读取Microsoft word文件。我已经将ApachePOI-3.8-beta1中的所有.jar文件都包含到了我的类路径中。但是,当我尝试运行此程序时,会出现以下异常: org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that de

我正在尝试通过Java读取Microsoft word文件。我已经将ApachePOI-3.8-beta1中的所有.jar文件都包含到了我的类路径中。但是,当我尝试运行此程序时,会出现以下异常:

org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
        at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:131)
        at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:104)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:138)
        at readingmsword07.Main.main(Main.java:27)
我使用XWPFWordExtractor,因为我试图阅读2007年的word文档,但由于某些原因,我无法找出正确的POI来处理此问题

非常感谢您的帮助。提前谢谢

~Woods

移开线路

POIFSFileSystem fileSystem = new POIFSFileSystem(fis);
POIFSFileSystem fileSystem = new POIFSFileSystem(fis);