use of org.docx4j.wml.CTTblCellMar in project docx4j-template by vindell.
the class Docx4j_工具类_S3_Test method setTableCellMargin.
/**
* @Description: 设置单元格Margin
*/
public void setTableCellMargin(Tbl tbl, String top, String right, String bottom, String left) {
TblPr tblPr = getTblPr(tbl);
CTTblCellMar cellMar = tblPr.getTblCellMar();
if (cellMar == null) {
cellMar = new CTTblCellMar();
tblPr.setTblCellMar(cellMar);
}
if (StringUtils.isNotBlank(top)) {
TblWidth topW = new TblWidth();
topW.setW(new BigInteger(top));
topW.setType("dxa");
cellMar.setTop(topW);
}
if (StringUtils.isNotBlank(right)) {
TblWidth rightW = new TblWidth();
rightW.setW(new BigInteger(right));
rightW.setType("dxa");
cellMar.setRight(rightW);
}
if (StringUtils.isNotBlank(bottom)) {
TblWidth btW = new TblWidth();
btW.setW(new BigInteger(bottom));
btW.setType("dxa");
cellMar.setBottom(btW);
}
if (StringUtils.isNotBlank(left)) {
TblWidth leftW = new TblWidth();
leftW.setW(new BigInteger(left));
leftW.setType("dxa");
cellMar.setLeft(leftW);
}
}
Aggregations