import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
public class L4
{
public static void main(String[] args)
{
File file = new File("C:\\t\\2.docx");
String str = "";
try {
FileInputStream fis = new FileInputStream(file);
XWPFDocument xdoc = new XWPFDocument(fis);
XWPFWordExtractor extractor = new XWPFWordExtractor(xdoc);
String doc1 = extractor.getText();
System.out.println(doc1);
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}