这个是怎么用的,下面写法有没有错?
异常信息:用户代码未处理 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);
byte[] bs = (byte[])read["文件"];
MemoryStream ms = new MemoryStream(bs);
Image img = Image.FromStream(ms);
byte[] bs = (byte[])read["文件"];
MemoryStream ms = new MemoryStream(bs);
Image img = Image.FromStream(ms);
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);
object Range = System.Reflection.Missing.Value;
appWord.Selection.ParagraphFormat.Alignment=WdParagraphAlignment.wdAlignParagraphRight;
appWord.Selection.InlineShapes.AddPicture(HostingEnvironment.ApplicationPhysicalPath + @"Images\Logo\"+dt1.Rows[0]["dLogo"]+"", ref oMissing, ref oMissing, ref Range);
object Range = System.Reflection.Missing.Value;
appWord.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight;
appWord.Selection.InlineShapes.AddPicture(HostingEnvironment.ApplicationPhysicalPath + @"Images\Logo\"+dt1.Rows[0]["dLogo"]+"", ref oMissing, ref oMissing, ref Range);