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
在此先感謝。等待好的迴應。