use of org.apache.poi.xwpf.usermodel.IBodyElement in project tika by apache.
the class XWPFWordExtractorDecorator method extractIBodyText.
private void extractIBodyText(IBody bodyElement, XWPFListManager listManager, XHTMLContentHandler xhtml) throws SAXException, XmlException, IOException {
for (IBodyElement element : bodyElement.getBodyElements()) {
if (element instanceof XWPFParagraph) {
XWPFParagraph paragraph = (XWPFParagraph) element;
extractParagraph(paragraph, listManager, xhtml);
}
if (element instanceof XWPFTable) {
XWPFTable table = (XWPFTable) element;
extractTable(table, listManager, xhtml);
}
if (element instanceof XWPFSDT) {
extractSDT((XWPFSDT) element, xhtml);
}
}
}
use of org.apache.poi.xwpf.usermodel.IBodyElement in project poi by apache.
the class XWPFWordExtractor method getText.
public String getText() {
StringBuffer text = new StringBuffer();
XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();
// Start out with all headers
extractHeaders(text, hfPolicy);
// Process all body elements
for (IBodyElement e : document.getBodyElements()) {
appendBodyElementText(text, e);
text.append('\n');
}
// Finish up with all the footers
extractFooters(text, hfPolicy);
return text.toString();
}
Aggregations