本文整理汇总了C#中NPOI.XWPF.UserModel.XWPFTable.GetCTTbl方法的典型用法代码示例。如果您正苦于以下问题:C# XWPFTable.GetCTTbl方法的具体用法?C# XWPFTable.GetCTTbl怎么用?C# XWPFTable.GetCTTbl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPOI.XWPF.UserModel.XWPFTable
的用法示例。
在下文中一共展示了XWPFTable.GetCTTbl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例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());
}
示例3: InsertTable
/**
* inserts an existing XWPFTable to the arrays bodyElements and tables
* @see NPOI.XWPF.UserModel.IBody#insertTable(int, NPOI.XWPF.UserModel.XWPFTable)
*/
public void InsertTable(int pos, XWPFTable table)
{
bodyElements.Insert(pos, table);
int i;
for (i = 0; i < ctTc.GetTblList().Count; i++) {
CT_Tbl tbl = ctTc.GetTblArray(i);
if(tbl == table.GetCTTbl()){
break;
}
}
tables.Insert(i, table);
}
示例4: InsertTable
/**
* inserts an existing XWPFTable to the arrays bodyElements and tables
* @param pos
* @param table
*/
public void InsertTable(int pos, XWPFTable table)
{
bodyElements.Insert(pos, table);
int i;
CT_Tbl[] barray = ctDocument.body.GetTblArray();
for (i = 0; i < barray.Length; i++)
{
//CT_Tbl tbl = ctDocument.body.GetTblArray(i);
if (barray[i] == table.GetCTTbl())
{
break;
}
}
tables.Insert(i, table);
}
示例5: SetTable
/**Replace content of table in array tables at position pos with a
* @param pos
* @param table
*/
public void SetTable(int pos, XWPFTable table)
{
tables[pos] = table;
ctDocument.body.SetTblArray(pos, table.GetCTTbl());
}