use of org.docx4j.wml.CTBorder in project docx4j-template by vindell.
the class Docx4J_简单例子2 method newImage.
public P newImage(WordprocessingMLPackage wordMLPackage, ObjectFactory factory, Part sourcePart, byte[] bytes, String filenameHint, String altText, int id1, int id2, JcEnumeration jcEnumeration) throws Exception {
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, sourcePart, bytes);
Inline inline = imagePart.createImageInline(filenameHint, altText, id1, id2, false);
P p = factory.createP();
R run = factory.createR();
p.getContent().add(run);
Drawing drawing = factory.createDrawing();
run.getContent().add(drawing);
drawing.getAnchorOrInline().add(inline);
PPr pPr = p.getPPr();
if (pPr == null) {
pPr = factory.createPPr();
}
Jc jc = pPr.getJc();
if (jc == null) {
jc = new Jc();
}
jc.setVal(jcEnumeration);
pPr.setJc(jc);
p.setPPr(pPr);
PBdr pBdr = pPr.getPBdr();
if (pBdr == null) {
pBdr = factory.createPPrBasePBdr();
}
CTBorder value = new CTBorder();
value.setVal(STBorder.SINGLE);
value.setColor("000000");
value.setSpace(new BigInteger("0"));
value.setSz(new BigInteger("3"));
pBdr.setBetween(value);
pPr.setPBdr(pBdr);
setParagraphSpacing(factory, p, jcEnumeration, "0", "0");
return p;
}
use of org.docx4j.wml.CTBorder in project docx4j-template by vindell.
the class Docx4J_简单例子2 method addBorders.
// 表格增加边框
public void addBorders(Tbl table, String borderSize) {
table.setTblPr(new TblPr());
CTBorder border = new CTBorder();
border.setColor("auto");
border.setSz(new BigInteger(borderSize));
border.setSpace(new BigInteger("0"));
border.setVal(STBorder.SINGLE);
TblBorders borders = new TblBorders();
borders.setBottom(border);
borders.setLeft(border);
borders.setRight(border);
borders.setTop(border);
borders.setInsideH(border);
borders.setInsideV(border);
table.getTblPr().setTblBorders(borders);
}
use of org.docx4j.wml.CTBorder in project docx4j-template by vindell.
the class Docx4jStyle_S3 method setCellBorders.
public void setCellBorders(Tc tableCell, boolean borderTop, boolean borderRight, boolean borderBottom, boolean borderLeft) {
TcPr tableCellProperties = tableCell.getTcPr();
if (tableCellProperties == null) {
tableCellProperties = new TcPr();
tableCell.setTcPr(tableCellProperties);
}
CTBorder border = new CTBorder();
// border.setColor("auto");
border.setColor("0000FF");
border.setSz(new BigInteger("20"));
border.setSpace(new BigInteger("0"));
border.setVal(STBorder.SINGLE);
TcBorders borders = new TcBorders();
if (borderBottom) {
borders.setBottom(border);
}
if (borderTop) {
borders.setTop(border);
}
if (borderLeft) {
borders.setLeft(border);
}
if (borderRight) {
borders.setRight(border);
}
tableCellProperties.setTcBorders(borders);
}
use of org.docx4j.wml.CTBorder in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method addRPrBorderStyle.
/**
* @Description: 设置字符边框
*/
public void addRPrBorderStyle(RPr runProperties, String size, STBorder bordType, String space, String color) {
CTBorder value = new CTBorder();
if (StringUtils.isNotBlank(color)) {
value.setColor(color);
}
if (StringUtils.isNotBlank(size)) {
value.setSz(new BigInteger(size));
}
if (StringUtils.isNotBlank(space)) {
value.setSpace(new BigInteger(space));
}
if (bordType != null) {
value.setVal(bordType);
}
runProperties.setBdr(value);
}
use of org.docx4j.wml.CTBorder in project docx4j-template by vindell.
the class SettingColumnWidthForTable method addBorders.
/**
* 本方法为表格添加边框
*/
private static void addBorders(Tbl table) {
table.setTblPr(new TblPr());
CTBorder border = new CTBorder();
border.setColor("auto");
border.setSz(new BigInteger("4"));
border.setSpace(new BigInteger("0"));
border.setVal(STBorder.SINGLE);
TblBorders borders = new TblBorders();
borders.setBottom(border);
borders.setLeft(border);
borders.setRight(border);
borders.setTop(border);
borders.setInsideH(border);
borders.setInsideV(border);
table.getTblPr().setTblBorders(borders);
}
Aggregations