use of org.docx4j.wml.TblPr in project docx4j-template by vindell.
the class Docx4J_简单例子2 method setTableAlign.
// 表格水平对齐方式
public void setTableAlign(ObjectFactory factory, Tbl table, JcEnumeration jcEnumeration) {
TblPr tablePr = table.getTblPr();
if (tablePr == null) {
tablePr = factory.createTblPr();
}
Jc jc = tablePr.getJc();
if (jc == null) {
jc = new Jc();
}
jc.setVal(jcEnumeration);
tablePr.setJc(jc);
table.setTblPr(tablePr);
}
use of org.docx4j.wml.TblPr in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setTblJcAlign.
/**
* @Description: 设置表格水平对齐方式(仅对表格起作用,单元格不一定水平对齐)
*/
public void setTblJcAlign(Tbl tbl, JcEnumeration jcType) {
if (jcType != null) {
TblPr tblPr = getTblPr(tbl);
Jc jc = tblPr.getJc();
if (jc == null) {
jc = new Jc();
tblPr.setJc(jc);
}
jc.setVal(jcType);
}
}
use of org.docx4j.wml.TblPr in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setTableWidth.
/**
* @Description: 设置表格总宽度
*/
public void setTableWidth(Tbl tbl, String width) {
if (StringUtils.isNotBlank(width)) {
TblPr tblPr = getTblPr(tbl);
TblWidth tblW = tblPr.getTblW();
if (tblW == null) {
tblW = new TblWidth();
tblPr.setTblW(tblW);
}
tblW.setW(new BigInteger(width));
tblW.setType("dxa");
}
}
use of org.docx4j.wml.TblPr 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);
}
use of org.docx4j.wml.TblPr in project docx4j-template by vindell.
the class TableWithMergedCells 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