苏飞论坛
标题:
C#怎么把图片写入到World中,不是URL是实际图片
[打印本页]
作者:
yangying
时间:
2013-5-17 08:41
标题:
C#怎么把图片写入到World中,不是URL是实际图片
这个就要用到AddPicture的函数 了。当然也不能使用我拉直接的字符串导入的方法了。那也是不行的,要使用组件的方式才可以。
[code=csharp]object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
object name= "d:\\myfile.doc";
object Range=System.Reflection.Missing.Value;
//Start Word and create a new document.
Word.Application oWord;
Word.Document oDoc;
oWord = new Word.ApplicationClass();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,ref oMissing, ref oMissing);
oWord.Selection.Font.Bold = 1;
oWord.Selection.Font.Size=18;
oWord.Selection.ParagraphFormat.Alignment =Word.WdParagraphAlignment.wdAlignParagraphCenter;
oWord.Selection.InlineShapes.AddPicture("e:/wzxsjs/picture/xczp/2005/02/K330206980000200501000201.jpg",ref oMissing,ref oMissing,ref Range); [/code]
欢迎光临 苏飞论坛 (http://www.sufeinet.com/)
Powered by Discuz! X3.4