怎么样才能向Word中动态的插入多个表格并填充数据,我每次只能插入一个表格并填充数据,当插入多时,第2个表格都嵌入到第一个表格的单元格内,请问怎么样才能将多个表格依次插入到文档的末尾,请高手们帮忙怎么解决呀,急啊,在线等,希望能给出示例代码。

解决方案 »

  1.   

    设置位置添加表格
     object WdLine = Word.WdUnits.wdLine;
     object oEndOfDoc = "Plan";
     Word.Range oRng = Doc.Books.get_Item(ref oEndOfDoc).Range;
      Word.Table tb = Doc.Tables.Add(oRng, 1, 2, ref nothing, ref nothing);
                        tb.Rows.Alignment = Word.WdRowAlignment.wdAlignRowCenter;
                        tb.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleSingle;
                        tb.Borders.InsideLineStyle = Word.WdLineStyle.wdLineStyleSingle;
                        int i = 1;
                        tb.Cell(1, 1).Range.Text = "起始年月";
                        tb.Cell(1, 2).Range.Text = "要求";
    WORD 编程
      

  2.   

    我自己已解决,
    object what=Word,WDUnits.wdline;
    object count=7 光标下移的数量
    object _oMissing=system.reflection.missing.value;selection.movedown(ref what,ref count,ref _omissing);selection.typeparagraph();推荐方法,把要实现的过程在word中录制宏,由宏来理解