use of org.docx4j.wml.CTBorder 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);
}
use of org.docx4j.wml.CTBorder in project docx4j-template by vindell.
the class TableWithStyledContent 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.CTBorder in project docx4j-template by vindell.
the class AddingAnInlineImageToTable method addBorders.
/**
* 给表格添加简单的黑色边框.
* @param table
*/
private static void addBorders(Tbl table) {
table.setTblPr(new TblPr());
CTBorder border = BorderUtils.ctBorder();
TblBorders borders = BorderUtils.tblBorders(border);
table.getTblPr().setTblBorders(borders);
}
use of org.docx4j.wml.CTBorder in project flexmark-java by vsch.
the class QuotedFormatProvider method adjustPPrForFormatting.
@Override
public void adjustPPrForFormatting(PPr pPr) {
// here we need to adjust for inherited left margin
final BigInteger newLeftInd = myDocx.getHelper().safeIndLeft(pPr);
final PPr styledPPr = myDocx.getHelper().getExplicitPPr(pPr);
if (styledPPr != null && styledPPr.getPBdr() != null && newLeftInd != null && newLeftInd.compareTo(myLeftInd) > 0) {
// it grew, word has the border hanging and we want the we shift it by our left border spacing
CTBorder leftBorder = styledPPr.getPBdr().getLeft();
if (leftBorder != null && leftBorder.getSpace() != null && leftBorder.getSpace().compareTo(BigInteger.ZERO) > 0) {
// pPr.getInd().setLeft(newLeftInd.add(leftBorder.getSpace().multiply(BigInteger.valueOf(20))));
final T currentNode = myDocx.getContextFrame();
if (currentNode instanceof Paragraph) {
int tmp = 0;
}
}
}
}
use of org.docx4j.wml.CTBorder in project Java-Tutorial by gpcodervn.
the class Docx4jUtils method setCellBorders.
private 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);
}
Aggregations