我写了段程序,已经实现了创建WORD文档,但是我现在只能在文档的头和尾加入文字内容,如何在中间加入文字内容?!我不知道该如何换行,用了Word.WdMovementType.Wdextend.
利用ActiveDocunment.Selection.MoveRigth(ref rows,ref cols,ref Extend);还是不能实现换行,到底是怎么回事啊,各位给个建议 ,请高手指教.具体代码如下:
Word.ApplicationClass wd=new Word.ApplicationClass();
object oMissing = System.Reflection.Missing.Value;
wd.Documents.Add(ref oMissing,ref oMissing,ref oMissing,ref oMissing);
Word.Document doc=wd.ActiveDocument;
wd.Visible=false; object extend=null;
object unit=null;
object count=0;
object character;
extend=Word.WdMovementType.wdExtend;
unit=Word.WdUnits.wdCell;
wd.Selection.Move(ref unit,ref count);
wd.Selection.TypeText("会议通知");
//换行
wd.Selection.MoveRight(ref unit,ref count,ref extend); count=2;
character=Word.WdUnits.wdCharacter;
wd.Selection.Move(ref character,ref count);
wd.Selection.TypeText("eeeeeee");在换行的位置,没有给我换行,来诊断下啊
利用ActiveDocunment.Selection.MoveRigth(ref rows,ref cols,ref Extend);还是不能实现换行,到底是怎么回事啊,各位给个建议 ,请高手指教.具体代码如下:
Word.ApplicationClass wd=new Word.ApplicationClass();
object oMissing = System.Reflection.Missing.Value;
wd.Documents.Add(ref oMissing,ref oMissing,ref oMissing,ref oMissing);
Word.Document doc=wd.ActiveDocument;
wd.Visible=false; object extend=null;
object unit=null;
object count=0;
object character;
extend=Word.WdMovementType.wdExtend;
unit=Word.WdUnits.wdCell;
wd.Selection.Move(ref unit,ref count);
wd.Selection.TypeText("会议通知");
//换行
wd.Selection.MoveRight(ref unit,ref count,ref extend); count=2;
character=Word.WdUnits.wdCharacter;
wd.Selection.Move(ref character,ref count);
wd.Selection.TypeText("eeeeeee");在换行的位置,没有给我换行,来诊断下啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货