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


C# XWPFTable.GetRow方法代码示例

本文整理汇总了C#中NPOI.XWPF.UserModel.XWPFTable.GetRow方法的典型用法代码示例。如果您正苦于以下问题:C# XWPFTable.GetRow方法的具体用法?C# XWPFTable.GetRow怎么用?C# XWPFTable.GetRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NPOI.XWPF.UserModel.XWPFTable的用法示例。


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

示例1: 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

示例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.NumberOfRows);
            Assert.IsNotNull(xtab.GetRow(2));

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

            //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:89sos98,项目名称:npoi,代码行数:30,代码来源:TestXWPFTable.cs

示例3: SetHeadings

        private void SetHeadings(ref XWPFDocument doc, XWPFTable table)
        {
            XWPFParagraph p1 = doc.CreateParagraph();
            XWPFRun r1 = p1.CreateRun();
            r1.SetBold(true);
            r1.SetText("Category");
            r1.SetBold(true);
            r1.SetFontFamily("Courier");
            table.GetRow(0).GetCell(0).SetParagraph(p1);

            XWPFParagraph p2 = doc.CreateParagraph();
            XWPFRun r2 = p2.CreateRun();
            r2.SetBold(true);
            r2.SetText("Category");
            r2.SetBold(true);
            r2.SetFontFamily("Courier");
            table.GetRow(0).GetCell(1).SetParagraph(p2);


        }
开发者ID:yuyi1,项目名称:Verdezyne-Operations,代码行数:20,代码来源:FermentationOutlineTable.cs

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: GetTable

        /// <summary>
        /// 获取节点中表的信息
        /// </summary>
        /// <param name="table">table</param>
        private TableInfo GetTable(XWPFTable table)
        {
            try
            {
                TableInfo mTable = new TableInfo();
                List<ColumnInfo> list = new List<ColumnInfo>();
                List<PkKeyInfo> listPkKeyInfo = new List<PkKeyInfo>();
                mTable.ListColumnInfo = list;
                mTable.ListPkKeyInfo = listPkKeyInfo;
                //表的ID
                mTable.TableObjectID = Guid.NewGuid().ToString();
                //表的中文名称
                mTable.Name = table.GetRow(0).GetCell(1).GetText().Trim();
                //表的英文名称
                mTable.Code = table.GetRow(1).GetCell(1).GetText().Trim();
                //表的描述
                mTable.Comment = mTable.Name;

                //标题列
                var row = table.GetRow(3);
                //缓存列索引和名称
                Dictionary<int, string> dic = new Dictionary<int, string>();
                int i = 0;
                foreach (var cell in row.GetTableCells())
                {
                    dic.Add(i, cell.GetText().Trim());
                    i++;
                }

                int iRow = 4;
                row = table.GetRow(iRow);
                while (row != null)
                {
                    InitColumns(row, dic, mTable);
                    iRow = iRow + 1;
                    row = table.GetRow(iRow);
                }

                if (string.IsNullOrEmpty(mTable.Comment))
                {
                    mTable.Comment = mTable.Name;
                }
                if (mTable.ListPkKeyInfo != null && mTable.ListPkKeyInfo.Count > 0)
                {
                    foreach (PkKeyInfo pkInfo in mTable.ListPkKeyInfo)
                    {
                        mTable.PkKeyNameList = mTable.PkKeyNameList + pkInfo.Name + ",";
                    }
                }
                if (!string.IsNullOrEmpty(mTable.PkKeyNameList))
                {
                    mTable.PkKeyNameList = mTable.PkKeyNameList.Substring(0, mTable.PkKeyNameList.Length - 1);
                }
                return mTable;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:iraychen,项目名称:DataDicPub,代码行数:64,代码来源:WordReader.cs


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