Microsoft Office Tutorials and References
In Depth Information
Adding an ActiveX control to Microsoft Office Word 2007 programmatically
Now, a developer can drag-and-drop the ActiveX control into the
UserControl that we will add to our Word 2007 document solution.
7. In the ThisDocument class, declare an instance of the UserControl1
wrapper, with UserControl1 as a private field in the class:
// Declare the instance of our UserControl
private UserControl1 ManagedActiveXCtrl;
8. In the ThisDocument_Startup method, instantiate UserControl1 and its
ClickEvent , and add the control to the Actions Pane of our document. When
the user clicks on the date in the calendar, write the selected date value in the
Word work-space.
// StartUp method of our Document in the solution
private void ThisDocument_Startup(object sender,
System.EventArgs e)
// Initializing the instance of the User control
ManagedActiveXCtrl = new UserControl1();
// Register the click event of the control
ManagedActiveXCtrl.axCalendar1.ClickEvent += new
// Add the control to the Actions Pane
// Click event of our User Control
private void axCalendar1_ClickEvent(object sender,
EventArgs e)
Search JabSto ::

Custom Search