Converting a Document Level Customization to a Vsto Se Addin

In this section, you'll convert a document-level customization that uses the actions pane to a VSTO 2005 SE add-in that uses the Custom task pane. In Chapter 5, you created an Excel solution that displays a custom-made Styles and Formatting task pane. That solution works only for a particular workbook, so let's convert the solution to a VSTO 2005 SE add-in so that it will work with any workbook that is opened.

1. Create a new Excel 2007 add-in project.

2. Add the user control you created for the Styles and Formatting solution in Chapter 5, or create a new one. If you create a new one, follow steps 3 through 11.

3. Resize the control so that its Width is 180 and its Height is 350.

4 Add two label controls, and change the style of the second label to resemble a text box by selecting a white background color and adding a border.

5. Keep the default name (Label1) for the first label, and change its Text property to Formatting of Active Cell.

6. Change the name of the second label to SelectionFont, and change Its AutoSize property to False.

7. Set the Width property of the SelectionFont label to 155, and its Height property to 50, and then clear out any text.

8. Add a Label control to UserControll, and change the Text property of the label to Pick formatting to apply.

9. Add a ListBox control to UserControll below the label, leaving the default name ListBoxl.

10. Resize the ListBox control so that its Width property is 155, and its Height property is 173.

11. Add a Button control below the ListBox control, and change its Text property to Reload Styles.

The user control you created (or copied from the project you created in

Chapter 5) should resemble the one in Figure 14.35.

Figure 14.35. Creating a user control for the Custom task pane
0 0

Post a comment