How to read all text in word document files (.doc, .doc etc) using aspose java.
I can’t find sample code anywhere.
The following Aspose.Words for Java code will get you all the text of Word document (DOC file) in a variable:
Document doc = new Document("E:\\Temp\\in.doc");
String docText = doc.toString(SaveFormat.TEXT).trim();
Another way is to read all the paragraphs in Word document and get their Text:
Document doc = new Document("E:\\Temp\\in.doc");
for (Paragraph para : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH,true)) {
System.out.println(para.toString(SaveFormat.TEXT).trim());
}
Please also refer to the following section of documentation:
@awais: Thanks