1
我正在创建MS Word VSTO。在VSTO中,我添加了一个自定义任务窗格,在MS Word的右侧显示我的用户控件。这是添加自定义任务窗格的代码片段。MS Word中的自定义任务窗格未加载
Public WithEvents _taskPane As Microsoft.Office.Tools.CustomTaskPane
Private myTaskPaneCollection As Microsoft.Office.Tools.CustomTaskPaneCollection
myTaskPaneCollection = Globals.Factory.CreateCustomTaskPaneCollection _
(Nothing, Nothing, "CustomTaskPanes", "CustomTaskPanes", Me)
_taskPane = myTaskPaneCollection.Add(dvPanel, My.Resources.dvTaskPane)
_taskPane.Control.Dock = Windows.Forms.DockStyle.Left
_taskPane.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight
_taskPane.DockPositionRestrict = MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal
_taskPane.Width = 300
_taskPane.Visible = True
注意:DVPANEL是我的用户控件,它将显示有关打开的Document的matadata。
I have written this code at Application.DocumentOpen() function as I want to display task pane only when any document is opened. It work fine when i run it from MS Visual Studio. But when I opened any Document from my application. It fails. Here is the snapshot of actual error.
我寻觅了很多,但无法获得更多的信息。这是我已经提到的一个链接。 http://social.msdn.microsoft.com/forums/vstudio/en-US/205cdc8b-3b20-4cb8-ad30-c6177e9f8435/argument-null-reference-exception-project-addin
在此先感谢。等待好的回应。