向word不能插入多张图片
//图片插入到word里public static void ImgToWord()
{
string sFileName = "E:\\T1.doc";
object objFileName=((object)sFileName);
Microsoft.Office.Interop.Word.Application Word_App = null;
Microsoft.Office.Interop.Word.Document Word_doc = null;
Microsoft.Office.Interop.Word.Shape oShape = null;
Word_App = new Microsoft.Office.Interop.Word.Application();
Word_doc = new Microsoft.Office.Interop.Word.Document();
object missing = Missing.Value;
Microsoft.Office.Interop.Word.Documents Docs = Word_App.Documents;
Word_App.Visible=true;
Microsoft.Office.Interop.Word._Document my_Doc = (Microsoft.Office.Interop.Word._Document)Word_doc;
Word_doc=Docs.Open(ref objFileName,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);
for (int i = 1; i < 3; i++)
{
oShape = Word_doc.Shapes.AddPicture("E:\\x" + i + ".jpg", ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
Word_doc.Save();
}
oShape.WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapNone;
Docs.Close(ref missing,ref missing,ref missing);
}
上面代码只能插入一张图片,请问怎样才能以此插入多张图片? --------------------编程问答-------------------- --------------------编程问答-------------------- 你把Word_doc.Save();放到循环的外面
补充:.NET技术 , ASP.NET