/** * Create a paragraph containing the string simpleText, * and add it to the document. If passed null, the result * is an empty P. * * @param simpleText * @return */ public org.docx4j.wml.P addParagraphOfText(String simpleText) { org.docx4j.wml.P para = createParagraphOfText(simpleText); addObject(para); return para; }
/** * Create a paragraph containing the string simpleText, styled * using the specified style (up to user to ensure it is a paragraph style) * without adding it to the document. * * @param styleId * @param text * @return */ public org.docx4j.wml.P createStyledParagraphOfText(String styleId, String text) { org.docx4j.wml.P p = createParagraphOfText(text); if (getPropertyResolver().activateStyle(styleId)) { // Style is available org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory(); org.docx4j.wml.PPr pPr = factory.createPPr(); p.setPPr(pPr); org.docx4j.wml.PPrBase.PStyle pStyle = factory.createPPrBasePStyle(); pPr.setPStyle(pStyle); pStyle.setVal(styleId); } return p; }
/** * Create a paragraph containing the string simpleText, * and add it to the document. If passed null, the result * is an empty P. * * @param simpleText * @return */ public org.docx4j.wml.P addParagraphOfText(String simpleText) { org.docx4j.wml.P para = createParagraphOfText(simpleText); addObject(para); return para; }
/** * Create a paragraph containing the string simpleText, styled * using the specified style (up to user to ensure it is a paragraph style) * without adding it to the document. * * @param styleId * @param text * @return */ public org.docx4j.wml.P createStyledParagraphOfText(String styleId, String text) { org.docx4j.wml.P p = createParagraphOfText(text); if (getPropertyResolver().activateStyle(styleId)) { // Style is available org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory(); org.docx4j.wml.PPr pPr = factory.createPPr(); p.setPPr(pPr); org.docx4j.wml.PPrBase.PStyle pStyle = factory.createPPrBasePStyle(); pPr.setPStyle(pStyle); pStyle.setVal(styleId); } return p; }