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. CT_TblCellMar ctm = new CT_TblCellMar(); Assert.IsNotNull(ctm); // create a table XWPFDocument doc = new XWPFDocument(); CT_Tbl ctTable = new CT_Tbl(); XWPFTable table = new XWPFTable(ctTable, doc); // Set margins table.SetCellMargins(50, 50, 250, 450); // Get margin components int t = table.GetCellMarginTop(); Assert.AreEqual(50, t); int l = table.GetCellMarginLeft(); Assert.AreEqual(50, l); int b = table.GetCellMarginBottom(); Assert.AreEqual(250, b); int r = table.GetCellMarginRight(); Assert.AreEqual(450, r); }
public int GetCellMarginRight() { int result = 0; CT_TblCellMar tblCellMar = this.GetTrPr().tblCellMar; if (tblCellMar != null) { CT_TblWidth right = tblCellMar.right; if (right != null) { int.TryParse(right.w, out result); } } return(result); }
public int GetCellMarginBottom() { int result = 0; CT_TblCellMar tblCellMar = this.GetTrPr().tblCellMar; if (tblCellMar != null) { CT_TblWidth bottom = tblCellMar.bottom; if (bottom != null) { int.TryParse(bottom.w, out result); } } return(result); }
public int GetCellMarginLeft() { int result = 0; CT_TblCellMar tblCellMar = this.GetTrPr().tblCellMar; if (tblCellMar != null) { CT_TblWidth left = tblCellMar.left; if (left != null) { int.TryParse(left.w, out result); } } return(result); }
public int GetCellMarginTop() { int result = 0; CT_TblCellMar tblCellMar = this.GetTrPr().tblCellMar; if (tblCellMar != null) { CT_TblWidth top = tblCellMar.top; if (top != null) { int.TryParse(top.w, out result); } } return(result); }
public int GetCellMarginRight() { int margin = 0; CT_TblPr tblPr = GetTrPr(); CT_TblCellMar tcm = tblPr.tblCellMar; if (tcm != null) { CT_TblWidth tw = tcm.right; if (tw != null) { int.TryParse(tw.w, out margin); } } return(margin); }
public void SetCellMargins(int top, int left, int bottom, int right) { CT_TblPr trPr = this.GetTrPr(); CT_TblCellMar ctTblCellMar = trPr.IsSetTblCellMar() ? trPr.tblCellMar : trPr.AddNewTblCellMar(); CT_TblWidth ctTblWidth1 = ctTblCellMar.IsSetLeft() ? ctTblCellMar.left : ctTblCellMar.AddNewLeft(); ctTblWidth1.type = ST_TblWidth.dxa; ctTblWidth1.w = left.ToString(); CT_TblWidth ctTblWidth2 = ctTblCellMar.IsSetTop() ? ctTblCellMar.top : ctTblCellMar.AddNewTop(); ctTblWidth2.type = ST_TblWidth.dxa; ctTblWidth2.w = top.ToString(); CT_TblWidth ctTblWidth3 = ctTblCellMar.IsSetBottom() ? ctTblCellMar.bottom : ctTblCellMar.AddNewBottom(); ctTblWidth3.type = ST_TblWidth.dxa; ctTblWidth3.w = bottom.ToString(); CT_TblWidth ctTblWidth4 = ctTblCellMar.IsSetRight() ? ctTblCellMar.right : ctTblCellMar.AddNewRight(); ctTblWidth4.type = ST_TblWidth.dxa; ctTblWidth4.w = right.ToString(); }
public void SetCellMargins(int top, int left, int bottom, int right) { CT_TblPr tblPr = GetTrPr(); CT_TblCellMar tcm = tblPr.IsSetTblCellMar() ? tblPr.tblCellMar : tblPr.AddNewTblCellMar(); CT_TblWidth tw = tcm.IsSetLeft() ? tcm.left : tcm.AddNewLeft(); tw.type = (ST_TblWidth.dxa); tw.w = left.ToString(); tw = tcm.IsSetTop() ? tcm.top : tcm.AddNewTop(); tw.type = (ST_TblWidth.dxa); tw.w = top.ToString(); tw = tcm.IsSetBottom() ? tcm.bottom : tcm.AddNewBottom(); tw.type = (ST_TblWidth.dxa); tw.w = bottom.ToString(); tw = tcm.IsSetRight() ? tcm.right : tcm.AddNewRight(); tw.type = (ST_TblWidth.dxa); tw.w = right.ToString(); }
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. CT_TblCellMar ctm = new CT_TblCellMar(); Assert.IsNotNull(ctm); // create a table XWPFDocument doc = new XWPFDocument(); CT_Tbl ctTable = new CT_Tbl(); XWPFTable table = new XWPFTable(ctTable, doc); // Set margins table.SetCellMargins(50, 50, 250, 450); // Get margin components int t = table.CellMarginTop; Assert.AreEqual(50, t); int l = table.CellMarginLeft; Assert.AreEqual(50, l); int b = table.CellMarginBottom; Assert.AreEqual(250, b); int r = table.CellMarginRight; Assert.AreEqual(450, r); }