Beispiel #1
0
        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);
        }
Beispiel #2
0
        /**
         * Set the vertical alignment of the cell.
         * @param vAlign - the desired alignment enum value
         */

        public void SetVerticalAlignment(XWPFVertAlign vAlign)
        {
            CT_TcPr       tcpr = ctTc.IsSetTcPr() ? ctTc.tcPr : ctTc.AddNewTcPr();
            CT_VerticalJc va   = tcpr.AddNewVAlign();

            va.val = (alignMap[(vAlign)]);
        }
Beispiel #3
0
        /**
         * Get the vertical alignment of the cell.
         * @return the cell alignment enum value
         */

        public XWPFVertAlign GetVerticalAlignment()
        {
            XWPFVertAlign vAlign = XWPFVertAlign.TOP;
            CT_TcPr       tcpr   = ctTc.tcPr;

            if (ctTc != null)
            {
                CT_VerticalJc va = tcpr.vAlign;
                vAlign = stVertAlignTypeMap[(va.val)];
            }
            return(vAlign);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        /**
         * Get the vertical alignment of the cell.
         * @return the cell alignment enum value or null if no vertical alignment is set
         */
        public XWPFVertAlign?GetVerticalAlignment()
        {
            XWPFVertAlign?vAlign = null;
            CT_TcPr       tcpr   = ctTc.tcPr;

            if (tcpr != null)
            {
                CT_VerticalJc va = tcpr.vAlign;
                if (va != null)
                {
                    vAlign = stVertAlignTypeMap[va.val.Value];
                }
                else
                {
                    vAlign = XWPFVertAlign.TOP;
                }
                if (va != null && va.val != null)
                {
                    vAlign = stVertAlignTypeMap[va.val.Value];
                }
            }
            return(vAlign);
        }