![]() ![]() Private void OnShutdown(object sender, EventArgs eventArgs) So I use the .Document.Shutdown event in my TaskPaneWrapper class like this: _vstoDocument = document.GetVstoObject() In its constructor, I create a new task pane and add it to the CustomTaskPanes collection with (taskPane, "Title") Īccording to MSDN, this associates the task pane with the currently active window.īoth Document.Close and Application.DocumentBeforeClose events don't suit me, because they fire before before the user gives the confirmation to close the document. If it doesn't exist, I create a new TaskPaneWrapper class. I do this because the open event fires if I try to open an already open document. In the CreateTaskPaneWrapper method, I check a Dictionary if a task pane for a document already exists. I create a custom task pane for each new, opened or existing on load document like this: ((ApplicationEvents4_Event) Application).NewDocument += CreateTaskPaneWrapper Īpplication.DocumentOpen += CreateTaskPaneWrapper įoreach (Document document in Application.Documents) Basically, I need to create a task pane for each document, show the correct task pane in the document window, do something on document close and then remove the task pane and all references to it. In my addin, I need a custom task pane for each open word document. I'm developing a Word 2007-2010 addin using VSTO in Visual Studio 2008.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |