private void menuItem5_Click(object sender, System.EventArgs e)
{
object fileName = "d://lesson_table.doc";
object oTemplate="d://课程表.dot";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
Word.Document oWordDoc = oWordApp.Documents.Add(ref oTemplate,ref missing,ref missing,ref missing);
// Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName,
// ref missing,ref readOnly,
// ref missing, ref missing, ref missing,
// ref missing, ref missing, ref missing,
// ref missing, ref missing, ref isVisible,
// ref missing,ref missing,ref missing,ref missing);
oWordDoc.Activate();
object oBookMark = "lesson_info";
object what = Word.WdGoToItem.wdGoToBookmark;
object unit1=missing;
object count1=1;
object extend1=Word.WdMovementType.wdMove;
// oWordApp.=oWordDoc.Bookmarks.get_Item(ref oBookMark).Range;
oWordApp.Selection.GoTo(ref what,ref missing,ref missing,ref oBookMark);
oWordApp.Selection.TypeText("abcde");
for(int i=0;i<11;i++)
{
oWordApp.Selection.MoveRight(ref unit1,ref count1,ref extend1);
oWordApp.Selection.TypeText("abcde");
}
// oWordDoc.Bookmarks.get_Item(ref oBookMark).Range.Text = "Some Text Here";
//
// oWordApp.Selection.TypeText("This is the text");
// oWordApp.Selection.TypeParagraph();
oWordDoc.SaveAs(ref fileName,
ref missing,ref readOnly,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible,
ref missing,ref missing,ref missing,ref missing);
oWordApp.Application.Quit(ref missing, ref missing, ref missing);
}