Search in sources :

Example 11 with CTBorder

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);
}
Also used : CTBorder(org.docx4j.wml.CTBorder) BigInteger(java.math.BigInteger) TblBorders(org.docx4j.wml.TblBorders) TblPr(org.docx4j.wml.TblPr)

Example 12 with CTBorder

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);
}
Also used : CTBorder(org.docx4j.wml.CTBorder) BigInteger(java.math.BigInteger) TblBorders(org.docx4j.wml.TblBorders) TblPr(org.docx4j.wml.TblPr)

Example 13 with CTBorder

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);
}
Also used : CTBorder(org.docx4j.wml.CTBorder) TblBorders(org.docx4j.wml.TblBorders) TblPr(org.docx4j.wml.TblPr)

Example 14 with CTBorder

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;
            }
        }
    }
}
Also used : PPr(org.docx4j.wml.PPr) CTBorder(org.docx4j.wml.CTBorder) BigInteger(java.math.BigInteger) Paragraph(com.vladsch.flexmark.ast.Paragraph)

Example 15 with CTBorder

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

Aggregations

CTBorder (org.docx4j.wml.CTBorder)24 BigInteger (java.math.BigInteger)22 P (org.docx4j.wml.P)9 PPr (org.docx4j.wml.PPr)9 TblBorders (org.docx4j.wml.TblBorders)9 TblPr (org.docx4j.wml.TblPr)9 CTVerticalJc (org.docx4j.wml.CTVerticalJc)8 Jc (org.docx4j.wml.Jc)8 PBdr (org.docx4j.wml.PPrBase.PBdr)8 R (org.docx4j.wml.R)8 STVerticalJc (org.docx4j.wml.STVerticalJc)8 Text (org.docx4j.wml.Text)3 Inline (org.docx4j.dml.wordprocessingDrawing.Inline)2 BinaryPartAbstractImage (org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage)2 Drawing (org.docx4j.wml.Drawing)2 Ftr (org.docx4j.wml.Ftr)2 Hdr (org.docx4j.wml.Hdr)2 ParaRPr (org.docx4j.wml.ParaRPr)2 RPr (org.docx4j.wml.RPr)2 TcPr (org.docx4j.wml.TcPr)2