Search in sources :

Example 6 with CTTblWidth

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth in project poi by apache.

the class XWPFTable method setCellMargins.

public void setCellMargins(int top, int left, int bottom, int right) {
    CTTblPr tblPr = getTrPr();
    CTTblCellMar tcm = tblPr.isSetTblCellMar() ? tblPr.getTblCellMar() : tblPr.addNewTblCellMar();
    CTTblWidth tw = tcm.isSetLeft() ? tcm.getLeft() : tcm.addNewLeft();
    tw.setType(STTblWidth.DXA);
    tw.setW(BigInteger.valueOf(left));
    tw = tcm.isSetTop() ? tcm.getTop() : tcm.addNewTop();
    tw.setType(STTblWidth.DXA);
    tw.setW(BigInteger.valueOf(top));
    tw = tcm.isSetBottom() ? tcm.getBottom() : tcm.addNewBottom();
    tw.setType(STTblWidth.DXA);
    tw.setW(BigInteger.valueOf(bottom));
    tw = tcm.isSetRight() ? tcm.getRight() : tcm.addNewRight();
    tw.setType(STTblWidth.DXA);
    tw.setW(BigInteger.valueOf(right));
}
Also used : CTTblWidth(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth) CTTblPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr) CTTblCellMar(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar)

Example 7 with CTTblWidth

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth in project poi by apache.

the class XWPFTable method getCellMarginTop.

public int getCellMarginTop() {
    int margin = 0;
    CTTblPr tblPr = getTrPr();
    CTTblCellMar tcm = tblPr.getTblCellMar();
    if (tcm != null) {
        CTTblWidth tw = tcm.getTop();
        if (tw != null) {
            margin = tw.getW().intValue();
        }
    }
    return margin;
}
Also used : CTTblWidth(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth) CTTblPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr) CTTblCellMar(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar)

Aggregations

CTTblPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr)7 CTTblWidth (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth)7 CTTblCellMar (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar)5 BigInteger (java.math.BigInteger)1 XWPFParagraph (org.apache.poi.xwpf.usermodel.XWPFParagraph)1 XWPFTable (org.apache.poi.xwpf.usermodel.XWPFTable)1 XWPFTableCell (org.apache.poi.xwpf.usermodel.XWPFTableCell)1 XWPFTableRow (org.apache.poi.xwpf.usermodel.XWPFTableRow)1 CTHeight (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHeight)1 CTShd (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTShd)1 CTString (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString)1 CTTbl (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)1 CTTcPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr)1 CTTrPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr)1 CTVerticalJc (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVerticalJc)1