【发布时间】:2018-01-10 07:44:16
【问题描述】:
我有一个插件,当我尝试将标签添加到插件时,请遵循以下指南: https://msdn.microsoft.com/en-us/library/cc442817.aspx
我收到了这个错误:
System.Runtime.InteropServices.COMException (0x800A03EC): Cannot insert object.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Shapes.AddOLEObject(Object ClassType, Object Filename, Object Link, Object DisplayAsIcon, Object IconFileName, Object IconIndex, Object IconLabel, Object Left, Object Top, Object Width, Object Height)
at Microsoft.Office.Tools.Excel.ControlCollectionImpl.CreateWrapperAndGetCookie(String name, Double left, Double top, Double width, Double height, Boolean anchor, _OLEObject& outObject)
at Microsoft.Office.Tools.Excel.ControlCollectionImpl.InternalAddOtherControl(Control control, Double left, Double top, Double width, Double height, String name, Boolean anchor)
at Microsoft.Office.Tools.Excel.ControlCollectionImpl.AddControl(Control control, Double left, Double top, Double width, Double height, String name)
at Microsoft.Office.Tools.Excel.ControlExtensions.AddLabel(
我添加标签的代码:
excelLabel = Microsoft.Office.Tools.Excel.ControlExtensions.AddLabel(
vstoDocument.Controls,
left,
top,
height,
width,
myLabelName);
我在 Stack Overflow 上发现了一些相同的错误代码但不同的消息答案。我试过了,但还是不行。
此错误仅发生在生产模式(已安装)上。它在开发模式下正常工作。 (我用的是office 365和windows 8)
有人知道这个问题吗?
【问题讨论】:
标签: c# vsto office-interop ole excel-addins