use of org.docx4j.wml.BooleanDefaultTrue in project mdw-designer by CenturyLinkCloud.
the class DocxBuilder method createBoldParagraph.
public P createBoldParagraph(String style, String text) {
ObjectFactory factory = Context.getWmlObjectFactory();
RPr rprDoc = factory.createRPr();
BooleanDefaultTrue b = new BooleanDefaultTrue();
b.setVal(true);
rprDoc.setB(b);
P pDoc = getMdp().createStyledParagraphOfText(style, text);
R rDoc = (R) pDoc.getContent().get(0);
rDoc.setRPr(rprDoc);
return pDoc;
}
use of org.docx4j.wml.BooleanDefaultTrue in project mdw-designer by CenturyLinkCloud.
the class DocxBuilder method addBoldParagraph.
public P addBoldParagraph(String text) {
ObjectFactory factory = Context.getWmlObjectFactory();
RPr rprDoc = factory.createRPr();
BooleanDefaultTrue b = new BooleanDefaultTrue();
b.setVal(true);
rprDoc.setB(b);
P pDoc = getMdp().addParagraphOfText(text);
R rDoc = (R) pDoc.getContent().get(0);
rDoc.setRPr(rprDoc);
return pDoc;
}
use of org.docx4j.wml.BooleanDefaultTrue in project mdw-designer by CenturyLinkCloud.
the class DocxBuilder method createParagraph.
public P createParagraph(String text, int fontSize, boolean bold) {
ObjectFactory factory = Context.getWmlObjectFactory();
RPr rprDoc = factory.createRPr();
if (fontSize != 0) {
HpsMeasure size = new HpsMeasure();
size.setVal(BigInteger.valueOf(fontSize * 2));
rprDoc.setSz(size);
}
if (bold) {
BooleanDefaultTrue b = new BooleanDefaultTrue();
b.setVal(true);
rprDoc.setB(b);
}
P pDoc = getMdp().createParagraphOfText(text);
R rDoc = (R) pDoc.getContent().get(0);
rDoc.setRPr(rprDoc);
return pDoc;
}
use of org.docx4j.wml.BooleanDefaultTrue in project Java-Tutorial by gpcodervn.
the class Docx4jUtils method setCellNoWrap.
private void setCellNoWrap(Tc tableCell) {
TcPr tableCellProperties = tableCell.getTcPr();
if (tableCellProperties == null) {
tableCellProperties = new TcPr();
tableCell.setTcPr(tableCellProperties);
}
BooleanDefaultTrue b = new BooleanDefaultTrue();
b.setVal(true);
tableCellProperties.setNoWrap(b);
}
use of org.docx4j.wml.BooleanDefaultTrue in project Java-Tutorial by gpcodervn.
the class Write_Format method main.
public static void main(String[] args) throws Docx4JException {
WordprocessingMLPackage wordPackage = WordprocessingMLPackage.createPackage();
MainDocumentPart mainDocumentPart = wordPackage.getMainDocumentPart();
mainDocumentPart.addStyledParagraphOfText("Title", "Hello World!");
mainDocumentPart.addParagraphOfText("Welcome To Baeldung");
ObjectFactory factory = Context.getWmlObjectFactory();
P p = factory.createP();
R r = factory.createR();
Text t = factory.createText();
t.setValue("Welcome To Baeldung");
r.getContent().add(t);
p.getContent().add(r);
RPr rpr = factory.createRPr();
BooleanDefaultTrue b = new BooleanDefaultTrue();
rpr.setB(b);
rpr.setI(b);
rpr.setCaps(b);
Color green = factory.createColor();
green.setVal("green");
rpr.setColor(green);
r.setRPr(rpr);
mainDocumentPart.getContent().add(p);
File exportFile = new File("output/welcome2.docx");
wordPackage.save(exportFile);
System.out.println("Done!");
}
Aggregations