use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar in project poi by apache.
the class XWPFTable method getCellMarginRight.
public int getCellMarginRight() {
int margin = 0;
CTTblPr tblPr = getTrPr();
CTTblCellMar tcm = tblPr.getTblCellMar();
if (tcm != null) {
CTTblWidth tw = tcm.getRight();
if (tw != null) {
margin = tw.getW().intValue();
}
}
return margin;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar in project poi by apache.
the class XWPFTable method getCellMarginLeft.
public int getCellMarginLeft() {
int margin = 0;
CTTblPr tblPr = getTrPr();
CTTblCellMar tcm = tblPr.getTblCellMar();
if (tcm != null) {
CTTblWidth tw = tcm.getLeft();
if (tw != null) {
margin = tw.getW().intValue();
}
}
return margin;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar in project poi by apache.
the class XWPFTable method getCellMarginBottom.
public int getCellMarginBottom() {
int margin = 0;
CTTblPr tblPr = getTrPr();
CTTblCellMar tcm = tblPr.getTblCellMar();
if (tcm != null) {
CTTblWidth tw = tcm.getBottom();
if (tw != null) {
margin = tw.getW().intValue();
}
}
return margin;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar in project poi by apache.
the class TestXWPFTable method testSetGetMargins.
public void testSetGetMargins() {
// instantiate the following class so it'll get picked up by
// the XmlBean process and added to the jar file. it's required
// for the following XWPFTable methods.
CTTblCellMar ctm = CTTblCellMar.Factory.newInstance();
assertNotNull(ctm);
// create a table
XWPFDocument doc = new XWPFDocument();
CTTbl ctTable = CTTbl.Factory.newInstance();
XWPFTable table = new XWPFTable(ctTable, doc);
// set margins
table.setCellMargins(50, 50, 250, 450);
// get margin components
int t = table.getCellMarginTop();
assertEquals(50, t);
int l = table.getCellMarginLeft();
assertEquals(50, l);
int b = table.getCellMarginBottom();
assertEquals(250, b);
int r = table.getCellMarginRight();
assertEquals(450, r);
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar 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));
}
Aggregations