C#操作WORD换行

 appWord.ActiveDocument.Bookmarks[bookMark].Select();

          Word.Selection wordSelection = appWord.ActiveDocument.Application.Selection;

          wordSelection.Range.Text = value;

就是因为没添加下面的语句,导致每次不是替换掉就是挤到后面。

          appWord.ActiveDocument.Application.Selection.MoveEnd();

下面是换行的代码

    object count = 14;
            object WdLine = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;
            appWord.Selection.MoveDown(ref WdLine, ref count, ref oMissing);//移动焦点
            appWord.Selection.TypeParagraph();//插入段落

posted @ 2016-12-01 09:30  赤狐(zcm123)  阅读(1998)  评论(0编辑  收藏  举报