use of org.docx4j.wml.TblBorders 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.TblBorders 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.TblBorders 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.TblBorders 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.TblBorders in project Java-Tutorial by gpcodervn.
the class TableBordersTest method testTableBorderPresence.
@Test
public void testTableBorderPresence() throws Docx4JException {
Tbl tbl = table("<table border='1'><tr><th>1</th></tr></table>");
TblBorders borders = tbl.getTblPr().getTblBorders();
assertEquals(STBorder.INSET, borders.getTop().getVal());
assertEquals(STBorder.INSET, borders.getBottom().getVal());
assertEquals(STBorder.INSET, borders.getLeft().getVal());
assertEquals(STBorder.INSET, borders.getRight().getVal());
assertEquals(STBorder.NONE, borders.getInsideH().getVal());
assertEquals(STBorder.NONE, borders.getInsideV().getVal());
assertTrue(borders.getTop().getSz().longValue() > 0);
assertTrue(borders.getBottom().getSz().longValue() > 0);
assertTrue(borders.getLeft().getSz().longValue() > 0);
assertTrue(borders.getRight().getSz().longValue() > 0);
TcPrInner.TcBorders borders2 = ((Tc) ((Tr) tbl.getContent().get(0)).getContent().get(0)).getTcPr().getTcBorders();
assertEquals(STBorder.OUTSET, borders2.getTop().getVal());
assertEquals(STBorder.OUTSET, borders2.getBottom().getVal());
assertEquals(STBorder.OUTSET, borders2.getLeft().getVal());
assertEquals(STBorder.OUTSET, borders2.getRight().getVal());
assertNull(borders2.getInsideH());
assertNull(borders2.getInsideV());
assertTrue(borders2.getTop().getSz().longValue() > 0);
assertTrue(borders2.getBottom().getSz().longValue() > 0);
assertTrue(borders2.getLeft().getSz().longValue() > 0);
assertTrue(borders2.getRight().getSz().longValue() > 0);
}
Aggregations