using MSword = Microsoft.Office.Interop.Word; public class Connect : Object, Extensibility.IDTExtensibility2, ICustomTaskPaneConsumer { public Connect() { } public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom) { applicationObject = (MSword.Application)application; addInInstance = addInInst; } public void OnStartupComplete(ref System.Array custom) { applicationObject.DocumentOpen += new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentOpenEventHandler(applicationObject_DocumentOpen); applicationObject.WindowActivate += new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowActivateEventHandler(applicationObject_WindowActivate); } void applicationObject_DocumentOpen(Microsoft.Office.Interop.Word.Document Doc) { AddCustomTaskPane(); } void applicationObject_WindowActivate(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn) { } public void OnBeginShutdown(ref System.Array custom) { } public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom) { } public void OnAddInsUpdate(ref System.Array custom) { } private MSword.Application applicationObject; private object addInInstance; #region ICustomTaskPaneConsumer Members ICTPFactory ctpFactory; object missing = Type.Missing; public void CTPFactoryAvailable(ICTPFactory CTPFactoryInst) { ctpFactory = CTPFactoryInst; AddCustomTaskPane(); } public void AddCustomTaskPane() { CustomTaskPane CTP = ctpFactory.CreateCTP("MyNameSpace.MyUserControl", "My Task Pane", missing); MyUserControl sampleAX = (MyUserControl)CTP.ContentControl; CTP.Visible = true; } #endregion }
Managing custom task panes across multiple documents in shared add in for office 2007 using .NET
I see a lot of articles on this topic but all are related to VSTO. But I required this for shared addin. I followed MSDN to create custom task pane using shared addin. It works fine but when multiple documents are opened then it appears only for the first document. I have implemented to show document wise custom task pane.
Related Posts :
Subscribe to:
Post Comments (Atom)
Hi,
ReplyDeleteI have encountered the exact same issue. Have you been able to resolve this?
Regards,
Adriaan