public void TestSetGetVertAlignment() { // instantiate the following classes so they'll Get picked up by // the XmlBean process and Added to the jar file. they are required // for the following XWPFTableCell methods. CT_Shd ctShd = new CT_Shd(); Assert.IsNotNull(ctShd); CT_VerticalJc ctVjc = new CT_VerticalJc(); Assert.IsNotNull(ctVjc); ST_Shd stShd = ST_Shd.nil; Assert.IsNotNull(stShd); ST_VerticalJc stVjc = ST_VerticalJc.top; Assert.IsNotNull(stVjc); // create a table XWPFDocument doc = new XWPFDocument(); CT_Tbl ctTable = new CT_Tbl(); XWPFTable table = new XWPFTable(ctTable, doc); // table has a single row by default; grab it XWPFTableRow tr = table.GetRow(0); Assert.IsNotNull(tr); // row has a single cell by default; grab it XWPFTableCell cell = tr.GetCell(0); cell.SetVerticalAlignment(XWPFTableCell.XWPFVertAlign.BOTH); XWPFTableCell.XWPFVertAlign al = cell.GetVerticalAlignment().Value; Assert.AreEqual(XWPFTableCell.XWPFVertAlign.BOTH, al); }
public XWPFTableCell.XWPFVertAlign GetVerticalAlignment() { XWPFTableCell.XWPFVertAlign xwpfVertAlign = XWPFTableCell.XWPFVertAlign.TOP; CT_TcPr tcPr = this.ctTc.tcPr; if (this.ctTc != null) { CT_VerticalJc vAlign = tcPr.vAlign; xwpfVertAlign = XWPFTableCell.stVertAlignTypeMap[vAlign.val]; } return(xwpfVertAlign); }
public void SetVerticalAlignment(XWPFTableCell.XWPFVertAlign vAlign) { (this.ctTc.IsSetTcPr() ? (CT_TcPrBase)this.ctTc.tcPr : (CT_TcPrBase)this.ctTc.AddNewTcPr()).AddNewVAlign().val = XWPFTableCell.alignMap[vAlign]; }