Word中画表格

来源:互联网 发布:淘宝客拍a发b 编辑:程序博客网 时间:2024/03/29 20:20

Word.Table oTable;

       Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;

       oTable = oDoc.Tables.Add(wrdRng, 3, 5, ref oMissing, ref oMissing);

       oTable.Range.ParagraphFormat.SpaceAfter = 6;

       int r, c;

       string strText;

       for(r = 1; r <= 3; r++)

              for(c = 1; c <= 5; c++)

              {

                     strText = "r" + r + "c" + c;

                     oTable.Cell(r, c).Range.Text = strText;

              }

       oTable.Rows[1].Range.Font.Bold = 1;

       oTable.Rows[1].Range.Font.Italic = 1;

原创粉丝点击