Example usage for org.apache.poi.xwpf.usermodel XWPFParagraph setStyle

List of usage examples for org.apache.poi.xwpf.usermodel XWPFParagraph setStyle

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFParagraph setStyle.

Prototype

public void setStyle(String styleId) 

Source Link

Document

Set the style ID for the paragraph

Usage

From source file:ru.ksu.niimm.cll.mocassin.rdf.ontology.util.OntologyReportGenerator.java

License:Open Source License

private static void addNeighbourClasses(XWPFDocument wordDocument, Set<OntClass> classes, String header) {
    if (classes.isEmpty())
        return;/*from   w  w  w .  j a v a  2 s. co  m*/
    XWPFParagraph paragraph = wordDocument.createParagraph();
    paragraph.setStyle("style0");
    XWPFRun run = paragraph.createRun();
    run.setText(header);
    StringBuilder sb = new StringBuilder();
    List<OntClass> classList = new ArrayList<OntClass>(classes);
    Collections.sort(classList, new OntClassByLabelComparatorAsc());
    Iterator<OntClass> it = classList.iterator();
    while (it.hasNext()) {
        OntClass clazz = it.next();
        sb.append(formatURI(clazz));
        if (it.hasNext()) {
            sb.append("; ");
        }
    }
    XWPFParagraph p = wordDocument.createParagraph();
    p.setIndentationLeft(1440);
    XWPFRun r = p.createRun();
    r.setText(sb.toString());
    r.setItalic(true);
    wordDocument.createParagraph().setIndentationLeft(1440);
}

From source file:ru.ksu.niimm.cll.mocassin.rdf.ontology.util.OntologyReportGenerator.java

License:Open Source License

private static void addURI(XWPFDocument wordDocument, OntClass ontClass) {
    XWPFParagraph paragraph = wordDocument.createParagraph();
    paragraph.setSpacingBefore(10);/*from w  ww  .  j  a  va  2  s .  c o m*/
    paragraph.setStyle("Heading 5");
    XWPFRun run = paragraph.createRun();
    run.setText(formatURI(ontClass));
}