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
 public XWPFTable(CT_Tbl table, IBody part, int row, int col)
     : this(table, part)
 {
     for (int i = 0; i < row; i++)
     {
         XWPFTableRow tabRow = (GetRow(i) == null) ? CreateRow() : GetRow(i);
         for (int k = 0; k < col; k++)
         {
             XWPFTableCell tabCell = (tabRow.GetCell(k) == null) ? tabRow
                                     .CreateCell() : null;
         }
     }
 }
Ejemplo n.º 3
0
        public XWPFTable(CT_Tbl table, IBody part, int row, int col)
            : this(table, part)
        {
            for (int pos1 = 0; pos1 < row; ++pos1)
            {
                XWPFTableRow xwpfTableRow = this.GetRow(pos1) == null?this.CreateRow() : this.GetRow(pos1);

                for (int pos2 = 0; pos2 < col; ++pos2)
                {
                    if (xwpfTableRow.GetCell(pos2) == null)
                    {
                        xwpfTableRow.CreateCell();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Test54099()
        {
            XWPFDocument  doc     = new XWPFDocument();
            CT_Tbl        ctTable = new CT_Tbl();
            XWPFTable     table   = new XWPFTable(ctTable, doc);
            XWPFTableRow  tr      = table.GetRow(0);
            XWPFTableCell cell    = tr.GetCell(0);

            CT_Tc     ctTc   = cell.GetCTTc();
            CT_TcPr   tcPr   = ctTc.AddNewTcPr();
            CT_HMerge hMerge = tcPr.AddNewHMerge();

            hMerge.val = (ST_Merge.restart);

            CT_TcBorders tblBorders = tcPr.AddNewTcBorders();
            CT_VMerge    vMerge     = tcPr.AddNewVMerge();
        }
Ejemplo n.º 5
0
        public void TestSetGetColor()
        {
            // 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.SetColor("F0000F");
            String clr = cell.GetColor();

            Assert.AreEqual("F0000F", clr);
        }
Ejemplo n.º 6
0
        public XWPFTable(CT_Tbl table, IBody part, int row, int col)
            : this(table, part)
        {
            CT_TblGrid ctTblGrid = table.AddNewTblGrid();

            for (int j = 0; j < col; j++)
            {
                CT_TblGridCol ctGridCol = ctTblGrid.AddNewGridCol();
                ctGridCol.w = 300;
            }
            for (int i = 0; i < row; i++)
            {
                XWPFTableRow tabRow = (GetRow(i) == null) ? CreateRow() : GetRow(i);
                for (int k = 0; k < col; k++)
                {
                    if (tabRow.GetCell(k) == null)
                    {
                        tabRow.CreateCell();
                    }
                }
            }
        }