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();
            Assert.AreEqual(XWPFTableCell.XWPFVertAlign.BOTH, al);
        }
Example #2
0
 public static CT_Shd Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Shd ctObj = new CT_Shd();
     if (node.Attributes["w:val"] != null)
         ctObj.val = (ST_Shd)Enum.Parse(typeof(ST_Shd), node.Attributes["w:val"].Value);
     ctObj.color = XmlHelper.ReadString(node.Attributes["w:color"]);
     if (node.Attributes["w:themeColor"] != null)
         ctObj.themeColor = (ST_ThemeColor)Enum.Parse(typeof(ST_ThemeColor), node.Attributes["w:themeColor"].Value);
     ctObj.themeTint = XmlHelper.ReadBytes(node.Attributes["w:themeTint"]);
     ctObj.themeShade = XmlHelper.ReadBytes(node.Attributes["w:themeShade"]);
     ctObj.fill = XmlHelper.ReadString(node.Attributes["w:fill"]);
     if (node.Attributes["w:themeFill"] != null)
         ctObj.themeFill = (ST_ThemeColor)Enum.Parse(typeof(ST_ThemeColor), node.Attributes["w:themeFill"].Value);
     ctObj.themeFillTint = XmlHelper.ReadBytes(node.Attributes["w:themeFillTint"]);
     ctObj.themeFillShade = XmlHelper.ReadBytes(node.Attributes["w:themeFillShade"]);
     return ctObj;
 }