本文整理汇总了C#中CT_Tbl.AddNewTr方法的典型用法代码示例。如果您正苦于以下问题:C# CT_Tbl.AddNewTr方法的具体用法?C# CT_Tbl.AddNewTr怎么用?C# CT_Tbl.AddNewTr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CT_Tbl
的用法示例。
在下文中一共展示了CT_Tbl.AddNewTr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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());
}
示例2: 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);
}
示例3: 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=(STTblLayoutType.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);
/*
* CTTblGrid tblgrid=table.AddNewTblGrid();
* tblgrid.AddNewGridCol().W=(new Bigint("2000"));
*/
GetRows();
}
示例4: 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;
}