Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /**
         * Set cell color. This sets some associated values; for finer control
         * you may want to access these elements individually.
         * @param rgbStr - the desired cell color, in the hex form "RRGGBB".
         */

        public void SetColor(string rgbStr)
        {
            CT_TcPr tcpr  = ctTc.IsSetTcPr() ? ctTc.tcPr : ctTc.AddNewTcPr();
            CT_Shd  ctshd = tcpr.IsSetShd() ? tcpr.shd : tcpr.AddNewShd();

            ctshd.color = ("auto");
            ctshd.val   = (ST_Shd.clear);
            ctshd.fill  = (rgbStr);
        }
Ejemplo n.º 3
0
        public void SetColor(string rgbStr)
        {
            CT_TcPr ctTcPr = this.ctTc.IsSetTcPr() ? this.ctTc.tcPr : this.ctTc.AddNewTcPr();
            CT_Shd  ctShd  = ctTcPr.IsSetShd() ? ctTcPr.shd : ctTcPr.AddNewShd();

            ctShd.color = "auto";
            ctShd.val   = ST_Shd.clear;
            ctShd.fill  = rgbStr;
        }
Ejemplo n.º 4
0
        /**
         * Get cell color. Note that this method only returns the "fill" value.
         * @return RGB string of cell color
         */

        public String GetColor()
        {
            String  color = null;
            CT_TcPr tcpr  = ctTc.tcPr;

            if (tcpr != null)
            {
                CT_Shd ctshd = tcpr.shd;
                if (ctshd != null)
                {
                    color = ctshd.fill;
                }
            }
            return(color);
        }
Ejemplo n.º 5
0
        public string GetColor()
        {
            string  str  = (string)null;
            CT_TcPr tcPr = this.ctTc.tcPr;

            if (tcPr != null)
            {
                CT_Shd shd = tcPr.shd;
                if (shd != null)
                {
                    str = shd.fill;
                }
            }
            return(str);
        }