110,534
社区成员
发帖
与我相关
我的任务
分享
table = m_Docx.CreateTable(1, 6);//创建1行6列表
m_CTTbl = m_Docx.Document.body.GetTblArray()[1];//获得文档第二张表
m_CTTblPr = m_CTTbl.AddNewTblPr();
m_CTTblPr.AddNewTblW().w = "8500"; //表宽
m_CTTblPr.AddNewTblW().type = ST_TblWidth.dxa;
m_CTTblPr.tblpPr = new CT_TblPPr();//表定位
m_CTTblPr.tblpPr.tblpX = "0";//表左上角坐标
m_CTTblPr.tblpPr.tblpY = "0";
m_CTTblPr.tblpPr.tblpXSpec = ST_XAlign.center;//若不为“Null”,则优先tblpX,即表由tblpXSpec定位
m_CTTblPr.tblpPr.tblpYSpec = ST_YAlign.Null;//若不为“Null”,则优先tblpY,即表由tblpYSpec定位
m_CTTblPr.tblpPr.leftFromText = (ulong)180;
m_CTTblPr.tblpPr.rightFromText = (ulong)180;
m_CTTblPr.tblpPr.vertAnchor = ST_VAnchor.text;
m_CTTblPr.tblpPr.horzAnchor = ST_HAnchor.page;
////表1行6列充值:
#region
CT_TcPr m_Pr = table.GetRow(0).GetCell(0).GetCTTc().AddNewTcPr();
m_Pr.tcW = new CT_TblWidth();
m_Pr.tcW.w = "50";//单元格宽
m_Pr.tcW.type = ST_TblWidth.dxa;
table.GetRow(0).GetCell(0).GetCTTc().AddNewTcPr().AddNewVAlign().val = ST_VerticalJc.center;//垂直居中
table.GetRow(0).GetCell(0).GetCTTc().GetPList()[0].AddNewPPr().AddNewJc().val = ST_Jc.center;
table.GetRow(0).GetCell(0).GetCTTc().GetPList()[0].AddNewR().AddNewT().Value = "序号";
table.GetRow(0).GetCell(1).GetCTTc().AddNewTcPr().AddNewVAlign().val = ST_VerticalJc.center;//垂直居中
table.GetRow(0).GetCell(1).GetCTTc().GetPList()[0].AddNewPPr().AddNewJc().val = ST_Jc.center;
table.GetRow(0).GetCell(1).GetCTTc().AddNewTcPr().tcW = new CT_TblWidth();
table.GetRow(0).GetCell(1).GetCTTc().AddNewTcPr().tcW.w = "8450";//单元格宽
table.GetRow(0).GetCell(1).GetCTTc().AddNewTcPr().tcW.type = ST_TblWidth.dxa;
table.GetRow(0).GetCell(1).GetCTTc().GetPList()[0].AddNewR().AddNewT().Value = "内容";
table.GetRow(0).GetCell(2).GetCTTc().AddNewTcPr().tcW = new CT_TblWidth();
table.GetRow(0).GetCell(2).GetCTTc().AddNewTcPr().tcW.w = "0";//单元格宽
table.GetRow(0).GetCell(2).GetCTTc().AddNewTcPr().tcW.type = ST_TblWidth.dxa;
table.GetRow(0).GetCell(2).GetCTTc().AddNewTcPr().AddNewVAlign().val = ST_VerticalJc.center;//垂直居中
table.GetRow(0).GetCell(2).GetCTTc().GetPList()[0].AddNewPPr().AddNewJc().val = ST_Jc.center;
table.GetRow(0).GetCell(2).GetCTTc().GetPList()[0].AddNewR().AddNewT().Value = "1";
table.GetRow(0).GetCell(3).GetCTTc().AddNewTcPr().tcW = new CT_TblWidth();
table.GetRow(0).GetCell(3).GetCTTc().AddNewTcPr().tcW.w = "0";//单元格宽
table.GetRow(0).GetCell(3).GetCTTc().AddNewTcPr().tcW.type = ST_TblWidth.dxa;
table.GetRow(0).GetCell(3).GetCTTc().AddNewTcPr().AddNewVAlign().val = ST_VerticalJc.center;//垂直居中
table.GetRow(0).GetCell(3).GetCTTc().GetPList()[0].AddNewPPr().AddNewJc().val = ST_Jc.center;
table.GetRow(0).GetCell(3).GetCTTc().GetPList()[0].AddNewR().AddNewT().Value = "2";
table.GetRow(0).GetCell(4).GetCTTc().AddNewTcPr().tcW = new CT_TblWidth();
table.GetRow(0).GetCell(4).GetCTTc().AddNewTcPr().tcW.w = "0";//单元格宽
table.GetRow(0).GetCell(4).GetCTTc().AddNewTcPr().tcW.type = ST_TblWidth.dxa;
table.GetRow(0).GetCell(4).GetCTTc().AddNewTcPr().AddNewVAlign().val = ST_VerticalJc.center;//垂直居中
table.GetRow(0).GetCell(4).GetCTTc().GetPList()[0].AddNewPPr().AddNewJc().val = ST_Jc.center;
table.GetRow(0).GetCell(4).GetCTTc().GetPList()[0].AddNewR().AddNewT().Value = "3";
table.GetRow(0).GetCell(5).GetCTTc().AddNewTcPr().tcW = new CT_TblWidth();
table.GetRow(0).GetCell(5).GetCTTc().AddNewTcPr().tcW.w = "0";//单元格宽
table.GetRow(0).GetCell(5).GetCTTc().AddNewTcPr().tcW.type = ST_TblWidth.dxa;
table.GetRow(0).GetCell(5).GetCTTc().AddNewTcPr().AddNewVAlign().val = ST_VerticalJc.center;//垂直居中
table.GetRow(0).GetCell(5).GetCTTc().GetPList()[0].AddNewPPr().AddNewJc().val = ST_Jc.center;
table.GetRow(0).GetCell(5).GetCTTc().GetPList()[0].AddNewR().AddNewT().Value = "4";