• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CT_Tbl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestSetGetVBorders

 public void TestSetGetVBorders()
 {
     // create a table
     XWPFDocument doc = new XWPFDocument();
     CT_Tbl ctTable = new CT_Tbl();
     XWPFTable table = new XWPFTable(ctTable, doc);
     // Set inside vertical border
     table.SetInsideVBorder(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.DOUBLE, 4, 0, "00FF00");
     // Get inside vertical border components
     NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.InsideVBorderType;
     Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.DOUBLE, bt);
     int sz = table.InsideVBorderSize;
     Assert.AreEqual(4, sz);
     int sp = table.InsideVBorderSpace;
     Assert.AreEqual(0, sp);
     String clr = table.InsideVBorderColor;
     Assert.AreEqual("00FF00", clr);
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:18,代码来源:TestXWPFTable.cs


示例17: TestSetGetHBorders

 public void TestSetGetHBorders()
 {
     // 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 XWPFTable methods.
     CT_TblBorders cttb = new CT_TblBorders();
     Assert.IsNotNull(cttb);
     ST_Border stb = new ST_Border();
     Assert.IsNotNull(stb);
     // create a table
     XWPFDocument doc = new XWPFDocument();
     CT_Tbl ctTable = new CT_Tbl();
     XWPFTable table = new XWPFTable(ctTable, doc);
     // Set inside horizontal border
     table.SetInsideHBorder(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, 4, 0, "FF0000");
     // Get inside horizontal border components
     int s = table.InsideHBorderSize;
     Assert.AreEqual(4, s);
     int sp = table.InsideHBorderSpace;
     Assert.AreEqual(0, sp);
     String clr = table.InsideHBorderColor;
     Assert.AreEqual("FF0000", clr);
     NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.InsideHBorderType;
     Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, bt);
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:25,代码来源:TestXWPFTable.cs


示例18: TestSetGetMargins

 public void TestSetGetMargins()
 {
     // instantiate the following class so it'll Get picked up by
     // the XmlBean process and Added to the jar file. it's required
     // for the following XWPFTable methods.
     CT_TblCellMar ctm = new CT_TblCellMar();
     Assert.IsNotNull(ctm);
     // create a table
     XWPFDocument doc = new XWPFDocument();
     CT_Tbl ctTable = new CT_Tbl();
     XWPFTable table = new XWPFTable(ctTable, doc);
     // Set margins
     table.SetCellMargins(50, 50, 250, 450);
     // Get margin components
     int t = table.CellMarginTop;
     Assert.AreEqual(50, t);
     int l = table.CellMarginLeft;
     Assert.AreEqual(50, l);
     int b = table.CellMarginBottom;
     Assert.AreEqual(250, b);
     int r = table.CellMarginRight;
     Assert.AreEqual(450, r);
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:23,代码来源:TestXWPFTable.cs


示例19: GetTable

 /**
  * Get a table by its CTTbl-Object
  * @see NPOI.XWPF.UserModel.IBody#getTable(org.Openxmlformats.schemas.wordProcessingml.x2006.main.CTTbl)
  */
 public XWPFTable GetTable(CT_Tbl ctTable)
 {
     for(int i=0; i<tables.Count; i++){
         if(this.Tables[(i)].GetCTTbl() == ctTable) return Tables[(i)]; 
     }
     return null;
 }
开发者ID:89sos98,项目名称:npoi,代码行数:11,代码来源:XWPFTableCell.cs


示例20: CreateEmptyTable

        private void CreateEmptyTable(CT_Tbl table)
        {
            // MINIMUM ELEMENTS FOR A TABLE
            table.AddNewTr().AddNewTc().AddNewP();

            CT_TblPr tblpro = table.AddNewTblPr();
            if (!tblpro.IsSetTblW())
                tblpro.AddNewTblW().w = "0";
            tblpro.tblW.type=(ST_TblWidth.auto);

            // layout
             tblpro.AddNewTblLayout().type =  ST_TblLayoutType.autofit;

            // borders
            CT_TblBorders borders = tblpro.AddNewTblBorders();
            borders.AddNewBottom().val=ST_Border.single;
            borders.AddNewInsideH().val = ST_Border.single;
            borders.AddNewInsideV().val = ST_Border.single;
            borders.AddNewLeft().val = ST_Border.single;
            borders.AddNewRight().val = ST_Border.single;
            borders.AddNewTop().val = ST_Border.single;

            
            CT_TblGrid tblgrid=table.AddNewTblGrid();
            tblgrid.AddNewGridCol().w= (ulong)2000;
           
        }
开发者ID:JustinChangTW,项目名称:npoi,代码行数:27,代码来源:XWPFTable.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CThostFtdcRspInfoField类代码示例发布时间:2022-05-24
下一篇:
C# CSteamID类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap