List of usage examples for org.apache.poi.xwpf.usermodel XWPFParagraph setNumID
public void setNumID(BigInteger numPos)
From source file:de.knowwe.include.export.DefinitionExporter.java
License:Open Source License
@Override public void export(Section<DefinitionType> section, DocumentBuilder manager) throws ExportException { XWPFDocument document = manager.getDocument(); BigInteger abstractID = ListExporter.getAbstractIdUnordered(document); BigInteger numID = document.getNumbering().addNum(abstractID); XWPFParagraph paragraph = manager.getNewParagraph(Style.list); paragraph.setNumID(numID); paragraph.getCTP().getPPr().getNumPr().addNewIlvl().setVal(BigInteger.valueOf(0)); ListBuilder listBuilder = new ListBuilder(manager); listBuilder.setBold(true);// ww w. j a va 2 s . co m listBuilder.export(section.get().getHeadSection(section)); listBuilder.setBold(false); manager.append(": "); manager.getParagraph().createRun().addCarriageReturn(); listBuilder.export(section.get().getDataSection(section)); manager.closeParagraph(); }
From source file:de.knowwe.include.export.ListExporter.java
License:Open Source License
public void exportItem(Section<DashTreeElement> section, BigInteger numID, DocumentBuilder builder) throws ExportException { String text = section.getText().trim(); int depth = 0; while (depth < text.length() && "#*".indexOf(text.charAt(depth)) >= 0) { depth++;//from w w w. j a va 2 s .co m } XWPFParagraph paragraph = builder.getNewParagraph(Style.list); paragraph.setNumID(numID); paragraph.getCTP().getPPr().getNumPr().addNewIlvl().setVal(BigInteger.valueOf(depth - 1)); ListBuilder listBuilder = new ListBuilder(builder); listBuilder.export(Sections.successor(section, DashTreeElementContent.class)); listBuilder.closeParagraph(); }
From source file:org.eclipse.sw360.licenseinfo.outputGenerators.DocxUtils.java
License:Open Source License
public static void addBulletList(XWPFDocument document, List<String> bulletListItems, boolean bulletListItemsAsLink) throws XmlException { CTNumbering cTNumbering = CTNumbering.Factory.parse(cTAbstractNumBulletXML); CTAbstractNum cTAbstractNum = cTNumbering.getAbstractNumArray(0); XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum); XWPFNumbering numbering = document.createNumbering(); BigInteger abstractNumID = numbering.addAbstractNum(abstractNum); BigInteger numID = numbering.addNum(abstractNumID); for (int i = 0; i < bulletListItems.size(); i++) { String bulletItem = bulletListItems.get(i); XWPFParagraph paragraph = document.createParagraph(); paragraph.setNumID(numID); if (bulletListItemsAsLink) { addBookmarkHyperLink(paragraph, bulletItem, bulletItem); } else {/*from w w w . j a va 2 s . c o m*/ setText(paragraph.createRun(), bulletItem); } if (i < bulletListItems.size() - 1) { paragraph.setSpacingAfter(0); } } }