Reading the docx file and try to stored in string variable below is my code
try {
File file = new File(fileName);
FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath());
XWPFDocument document = new XWPFDocument(fileInputStream);
List<XWPFParagraph> paragraphs = document.getParagraphs();
for (XWPFParagraph para : paragraphs) {
System.out.println(para.getText());
docContent = para.getText();
}
fileInputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
its Read the content successfully, but its not stored the entire content in string variable (docContent
),