object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word._Application oWord;
Microsoft.Office.Interop.Word._Document oDoc;
oWord = new Microsoft.Office.Interop.Word.Application();
//顯示word文檔
oWord.Visible = true;
//取得word文件模板
object fileName = System.Windows.Forms.Application.StartupPath + "\\word.doc";
//根據模板生成一個新文檔,相當于另存為
oDoc = oWord.Documents.Add(ref fileName, ref oMissing,
ref oMissing, ref oMissing);
//復制第一個表格
oDoc.Tables[1].Select();
oWord.Selection.Copy();
//在這里操作表格中的文本
oDoc.Tables[1].Cell(1, 1).Range.Text = "這是第一個表格";
//下一頁
object mymissing = System.Reflection.Missing.Value;
object myunit = Microsoft.Office.Interop.Word.WdUnits.wdStory;
oWord.Selection.EndKey(ref myunit, ref mymissing);
object pBreak = (int)Microsoft.Office.Interop.Word.WdBreakType.wdPageBreak;
oWord.Selection.InsertBreak(ref pBreak);
//粘貼第一個表格
oWord.Selection.Paste();
oDoc.Tables[2].Cell(1, 1).Range.Text = "這是第二個表格";