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