Microsoft Office Tutorials and References
In Depth Information
Designing the Actions Pane
Designing the Actions Pane
As we saw in the previous section, the Actions Pane is placed inside the document
Actions Task pane, which is hosted within the Word Task pane. To customize the
document Actions Task pane, you can use VSTO and Visual Studio's support for
adding controls and creating rich user interfaces in the Actions Pane.
The DateTimePicker control will insert the selected date in a Word document. Let's
add a DateTimePicker control to the Actions Pane:
1. Open Visual Studio 2008 to create a new Word 2007 Document
template project.
2. Select New Project . Under Office select 2007 and then select the Word 2007
Document template, and name the project as you wish.
3. Next, you need to select the document type, and name the document for
your solution.
4. The solution will be created with all of the required supporting files for our
development of a Word solution.
5. Write the program to show Actions Pane in Microsoft Office Word 2007,
inside the ThisDocument.cs file. You can add controls directly through the
code. The following is the code snippet to add controls:
// Initializing the DateTimePicker control
DateTimePicker _PacktDateTimePicker = new DateTimePicker();
// Code to add control in Document Actions Pane
private void ThisDocument_Startup(object sender,
System.EventArgs e)
// Adding the DateTimePicker to the controls of the Actions Pane
6. Next, to add the value selected from the DateTimePicker to the document
content, you need to work on the events of the DateTimePicker control.
private void InternalStartup()
// ValueChanged Event registration in the InternalStartup of
the application
this. _PacktDateTimePicker.ValueChanged += new System.
EventHandler(this. _PacktDateTimePicker_ValueChanged);
// ValueChanged event of PacktDateTimePicker
private void PacktDateTimePicker_ValueChanged(object sender,
EventArgs e)
Search JabSto ::

Custom Search