问题描述
这是我写的代码但是只能在第一页插入图片我想要的是在任意一页任意位置都可以插入图片ObjectNothing=System.Reflection.Missing.Value;Microsoft.Office.Interop.Word.ApplicationoWord;Microsoft.Office.Interop.Word.DocumentoDoc;objectname="d:\wordFile/myfile.doc";objectRange=System.Reflection.Missing.Value;oWord=newMicrosoft.Office.Interop.Word.ApplicationClass();oWord.Visible=false;//打开文档oDoc=oWord.Documents.Open(refname,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing);objecta=true;objectb=true;objectleft=null;objecttop=null;//定义位置if(len==1){left=80;top=280;}if(len==2){left=80;top=480;}if(len==3){left=80;top=680;}if(len==4){left=80;top=880;}if(len==5){left=80;top=1080;}objectwidth=300;objectheight=150;oDoc.Shapes.AddPicture(str,refa,refb,refleft,reftop,refwidth,refheight,refNothing);oDoc.Save();oWord.Documents.Close(refNothing,refNothing,refNothing);请大家指教谢谢!!!