当前位置: 首页>>代码示例>>C#>>正文


C# CT_Tbl类代码示例

本文整理汇总了C#中CT_Tbl的典型用法代码示例。如果您正苦于以下问题:C# CT_Tbl类的具体用法?C# CT_Tbl怎么用?C# CT_Tbl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CT_Tbl类属于命名空间,在下文中一共展示了CT_Tbl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XWPFTable

        public XWPFTable(CT_Tbl table, IBody part)
        {
            this.part = part;
            this.ctTbl = table;

            tableRows = new List<XWPFTableRow>();
            // is an empty table: I add one row and one column as default
            if (table.SizeOfTrArray() == 0)
                CreateEmptyTable(table);

            foreach (CT_Row row in table.GetTrList()) {
                StringBuilder rowText = new StringBuilder();
                row.Table = table;
                XWPFTableRow tabRow = new XWPFTableRow(row, this);
                tableRows.Add(tabRow);
                foreach (CT_Tc cell in row.GetTcList()) {
                    cell.TableRow = row;
                    foreach (CT_P ctp in cell.GetPList()) {
                        XWPFParagraph p = new XWPFParagraph(ctp, part);
                        if (rowText.Length > 0) {
                            rowText.Append('\t');
                        }
                        rowText.Append(p.GetText());
                    }
                }
                if (rowText.Length > 0) {
                    this.text.Append(rowText);
                    this.text.Append('\n');
                }
            }
        }
开发者ID:hanwangkun,项目名称:npoi,代码行数:31,代码来源:XWPFTable.cs

示例2: TestCreateRow

        public void TestCreateRow()
        {
            XWPFDocument doc = new XWPFDocument();

            CT_Tbl table = new CT_Tbl();
            CT_Row r1 = table.AddNewTr();
            r1.AddNewTc().AddNewP();
            r1.AddNewTc().AddNewP();
            CT_Row r2 = table.AddNewTr();
            r2.AddNewTc().AddNewP();
            r2.AddNewTc().AddNewP();
            CT_Row r3 = table.AddNewTr();
            r3.AddNewTc().AddNewP();
            r3.AddNewTc().AddNewP();

            XWPFTable xtab = new XWPFTable(table, doc);
            Assert.AreEqual(3, xtab.GetNumberOfRows());
            Assert.IsNotNull(xtab.GetRow(2));

            //add a new row
            xtab.CreateRow();
            Assert.AreEqual(4, xtab.GetNumberOfRows());

            //check number of cols
            Assert.AreEqual(2, table.GetTrArray(0).SizeOfTcArray());

            //check creation of first row
            xtab = new XWPFTable(new CT_Tbl(), doc);
            Assert.AreEqual(1, xtab.GetCTTbl().GetTrArray(0).SizeOfTcArray());
        }
开发者ID:xoposhiy,项目名称:npoi,代码行数:30,代码来源:TestXWPFTable.cs

示例3: TestSetGetVertAlignment

        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);
        }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:28,代码来源:TestXWPFTableCell.cs

示例4: TestTblGrid

        public void TestTblGrid()
        {
            XWPFDocument doc = new XWPFDocument();
            CT_Tbl ctTable = new CT_Tbl();
            CT_TblGrid cttblgrid = ctTable.AddNewTblGrid();
            cttblgrid.AddNewGridCol().w = 123;
            cttblgrid.AddNewGridCol().w = 321;

            XWPFTable xtab = new XWPFTable(ctTable, doc);
            Assert.AreEqual(123, xtab.GetCTTbl().tblGrid.gridCol[0].w);
            Assert.AreEqual(321, xtab.GetCTTbl().tblGrid.gridCol[1].w);
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:12,代码来源:TestXWPFTable.cs

示例5: TestGetText

        public void TestGetText()
        {
            XWPFDocument doc = new XWPFDocument();
            CT_Tbl table = new CT_Tbl();
            CT_Row row = table.AddNewTr();
            CT_Tc cell = row.AddNewTc();
            CT_P paragraph = cell.AddNewP();
            CT_R run = paragraph.AddNewR();
            CT_Text text = run.AddNewT();
            text.Value = ("finally I can Write!");

            XWPFTable xtab = new XWPFTable(table, doc);
            Assert.AreEqual("finally I can Write!\n", xtab.Text);
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:14,代码来源:TestXWPFTable.cs

示例6: TestSetGetRepeatHeader

        public void TestSetGetRepeatHeader()
        {
            // 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);

            tr.SetRepeatHeader(true);
            bool isRpt = tr.IsRepeatHeader();
            //assert(isRpt);
            Assert.IsTrue(isRpt);
        }
开发者ID:jdineshk,项目名称:npoi,代码行数:15,代码来源:TestXWPFTableRow.cs

示例7: TestSetGetCantSplitRow

        public void TestSetGetCantSplitRow()
        {
            // 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);

            tr.IsCantSplitRow = true;
            bool isCant = tr.IsCantSplitRow;
            //assert(isCant);
            Assert.IsTrue(isCant);
        }
开发者ID:JustinChangTW,项目名称:npoi,代码行数:15,代码来源:TestXWPFTableRow.cs

示例8: Test54099

        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();
        }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:16,代码来源:TestXWPFTableCell.cs

示例9: TestSetGetColor

        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);
        }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:16,代码来源:TestXWPFTableCell.cs

示例10: TestConstructor

        public void TestConstructor()
        {
            XWPFDocument doc = new XWPFDocument();
            CT_Tbl ctTable = new CT_Tbl();
            XWPFTable xtab = new XWPFTable(ctTable, doc);
            Assert.IsNotNull(xtab);
            Assert.AreEqual(1, ctTable.SizeOfTrArray());
            Assert.AreEqual(1, ctTable.GetTrArray(0).SizeOfTcArray());
            Assert.IsNotNull(ctTable.GetTrArray(0).GetTcArray(0).GetPArray(0));

            ctTable = new CT_Tbl();
            xtab = new XWPFTable(ctTable, doc, 3, 2);
            Assert.IsNotNull(xtab);
            Assert.AreEqual(3, ctTable.SizeOfTrArray());
            Assert.AreEqual(2, ctTable.GetTrArray(0).SizeOfTcArray());
            Assert.IsNotNull(ctTable.GetTrArray(0).GetTcArray(0).GetPArray(0));
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:17,代码来源:TestXWPFTable.cs

示例11: XWPFTable

        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();
                    }
                }
            }
        }
开发者ID:JustinChangTW,项目名称:npoi,代码行数:22,代码来源:XWPFTable.cs

示例12: TestSetGetWidth

        public void TestSetGetWidth()
        {
            XWPFDocument doc = new XWPFDocument();

            CT_Tbl table = new CT_Tbl();
            table.AddNewTblPr().AddNewTblW().w = "1000";

            XWPFTable xtab = new XWPFTable(table, doc);

            Assert.AreEqual(1000, xtab.Width);

            xtab.Width = 100;
            Assert.AreEqual(100, int.Parse(table.tblPr.tblW.w));
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:14,代码来源:TestXWPFTable.cs

示例13: GetTable

 /**
  * if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header
  * the method will return this table
  * if there is no corresponding {@link XWPFTable} the method will return null 
  * @param ctTable
  */
 public XWPFTable GetTable(CT_Tbl ctTable)
 {
     foreach (XWPFTable table in tables)
     {
         if (table == null)
             return null;
         if (table.GetCTTbl().Equals(ctTable))
             return table;
     }
     return null;
 }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:17,代码来源:XWPFHeaderFooter.cs

示例14: TestSetGetRowBandSize

 public void TestSetGetRowBandSize()
 {
     XWPFDocument doc = new XWPFDocument();
     CT_Tbl ctTable = new CT_Tbl();
     XWPFTable table = new XWPFTable(ctTable, doc);
     table.SetRowBandSize(12);
     int sz = table.GetRowBandSize();
     Assert.AreEqual(12, sz);
 }
开发者ID:kahinke,项目名称:npoi,代码行数:9,代码来源:TestXWPFTable.cs

示例15: TestSetGetColBandSize

 public void TestSetGetColBandSize()
 {
     XWPFDocument doc = new XWPFDocument();
     CT_Tbl ctTable = new CT_Tbl();
     XWPFTable table = new XWPFTable(ctTable, doc);
     table.ColBandSize = 16;
     int sz = table.ColBandSize;
     Assert.AreEqual(16, sz);
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:9,代码来源:TestXWPFTable.cs


注:本文中的CT_Tbl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。