C#写入图片到word------------Shapes.AddPicture
这个是怎么用的,下面写法有没有错?
异常信息:用户代码未处理 System.Runtime.InteropServices.COMException
HelpLink="C:\\Program Files\\Microsoft Office\\OFFICE11\\2052\\wdmain11.chm#25332"
Message="要求的对象不可用。"
Source="Microsoft Word"
ErrorCode=-2146822436
StackTrace:
在 Microsoft.Office.Interop.Word.Shapes.AddPicture(String FileName, Object& LinkToFile, Object& SaveWithDocument, Object& Left, Object& Top, Object& Width, Object& Height, Object& Anchor)
在 MSOffice.NSWord.WordDocuments.AppendTableYouteSonghuodanTou(Int32 numRows, Int32 numColumns, WordTableFormat format, Int32 type, String billNumbers, DataTable dt) 位置 D:\客户\CRM_V1.root\CRM_V1\OfficeNS\Word\WordDocumentsYoute.cs:行号 169
在 MSOffice.NSWord.WordDocuments.CreateWordSonghuodan(DataTable dt1, String billNumbers, String songhuodanJine, DataTable dt) 位置 D:\客户\CRM_V1.root\CRM_V1\OfficeNS\Word\WordDocumentsYoute.cs:行号 384
在 Factory_SellingList.gvDistributions_RowCommand(Object sender, GridViewCommandEventArgs e) 位置 d:\客户\CRM_V1.root\CRM_V1\WebSites\Factory\SellingList.aspx.cs:行号 378
在 System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e)
在 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
在 System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e)
在 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
在 System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)
在 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
在 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
在 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
是什么???













求高人现身


Microsoft.Office.Interop.Word.Application oDoc = new Microsoft.Office.Interop.Word.Application();
object LinkToFile = false;
object SaveWithDocument = true;
object Left = 50;//插入点相对距离
object Top = 50;//插入点相对距离
object Width = 86;//图片宽
object Height = 85;//图片高
object tmp1 = null;
string fileName = @"../Images/youte.bmp";
oDoc.Application.ActiveDocument.Shapes.AddPicture(fileName,ref LinkToFile,ref SaveWithDocument, ref Left, ref Top, ref Width, ref Height, ref tmp1);
...全文
相关推荐
C# Office组件编程实例
Word.Document doc = wordApp.Documents.Add();```三、Excel数据处理C#可以用于处理Excel数据,例如读取、写入和分析电子表格。
c# 提取word文件中图片
在C#编程环境中,提取Word文件中的图片是一项常见的任务,特别是在文档处理或自动化工作中。
C#实现Word中替换文字和图片
C#实现Word中替换文字和图片C#实现Word中替换文字和图片是指使用C#语言编程在Word文档中实现文字和图片的替换操作。
把PictureBox1里的图片插入替换word文字
,如果需要作为浮动图形 // targetRange.Shapes.AddPicture(imageBytes, false, true, 0, 0, -1, -1); ```6.
C# WPS操作,页眉添加图片
pictureShape = header.Shapes.AddPicture( imagePath, MsoTriState.msoFalse, MsoTriState.msoCTrue, 0,


