Search in sources :

Example 1 with TcBorders

use of org.docx4j.wml.TcPrInner.TcBorders 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);
}
Also used : TcPr(org.docx4j.wml.TcPr) CTBorder(org.docx4j.wml.CTBorder) BigInteger(java.math.BigInteger) TcBorders(org.docx4j.wml.TcPrInner.TcBorders)

Example 2 with TcBorders

use of org.docx4j.wml.TcPrInner.TcBorders 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);
}
Also used : TcPr(org.docx4j.wml.TcPr) CTBorder(org.docx4j.wml.CTBorder) BigInteger(java.math.BigInteger) TcBorders(org.docx4j.wml.TcPrInner.TcBorders)

Aggregations

BigInteger (java.math.BigInteger)2 CTBorder (org.docx4j.wml.CTBorder)2 TcPr (org.docx4j.wml.TcPr)2 TcBorders (org.docx4j.wml.TcPrInner.TcBorders)2