Example usage for org.apache.poi.xwpf.model XWPFCommentsDecorator XWPFCommentsDecorator

List of usage examples for org.apache.poi.xwpf.model XWPFCommentsDecorator XWPFCommentsDecorator

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.model XWPFCommentsDecorator XWPFCommentsDecorator.

Prototype

public XWPFCommentsDecorator(XWPFParagraphDecorator nextDecorator) 

Source Link

Usage

From source file:org.olat.search.service.document.file.WordOOXMLDocument.java

License:Apache License

private void extractContent(final StringBuilder buffy, final XWPFDocument document)
        throws IOException, XmlException {
    // first all paragraphs
    final Iterator<XWPFParagraph> i = document.getParagraphsIterator();
    while (i.hasNext()) {
        final XWPFParagraph paragraph = i.next();
        CTSectPr ctSectPr = null;//from  ww w .j av  a 2s . c  o m
        if (paragraph.getCTP().getPPr() != null) {
            ctSectPr = paragraph.getCTP().getPPr().getSectPr();
        }

        XWPFHeaderFooterPolicy headerFooterPolicy = null;
        if (ctSectPr != null) {
            headerFooterPolicy = new XWPFHeaderFooterPolicy(document, ctSectPr);
            extractHeaders(buffy, headerFooterPolicy);
        }

        final XWPFParagraphDecorator decorator = new XWPFCommentsDecorator(
                new XWPFHyperlinkDecorator(paragraph, null, true));

        final CTBookmark[] bookmarks = paragraph.getCTP().getBookmarkStartArray();
        for (final CTBookmark bookmark : bookmarks) {
            buffy.append(bookmark.getName()).append(' ');
        }

        buffy.append(decorator.getText()).append(' ');

        if (ctSectPr != null) {
            extractFooters(buffy, headerFooterPolicy);
        }
    }
}