Yesterday, the beta version of 3.5 was already supported by the 2007 Open XML Format (DOCX,PPTX,XLSX) for POI.
Need to join Poi-ooxml-3.5-beta6-xxxx.jar. But the Poi-ooxml-3.5-beta6-xxxx.jar package requires several packages under the Ooxml-lib directory to run.
The code is as follows
Import java.util.ArrayList; Import Java.io.File; Import Java.io.FileInputStream; Import Org.apache.poi.hwpf.extractor.WordExtractor; Import Org.apache.poi.xwpf.extractor.XWPFWordExtractor; Import Org.apache.poi.openxml4j.opc.OPCPackage; public class Dirwordreader {public static String Readdoc (String docpath) throws exception{FileInputStream fin=new Filein Putstream (New File (Docpath)); Wordextractor extractor=new wordextractor (Fin); String Doctext=extractor.gettext (); return doctext; public static string Readdocx (String docxpath) throws exception{opcpackage Opc=opcpackage.open (Docxpath); Xwpfwordextractor extractor=new Xwpfwordextractor (OPC); String Docxtext=extractor.gettext (); return docxtext; } }