VSTO: My Favorite Feature - Word Content Controls
The new content controls in Word 2007 are great for a number of reasons:
- Drag and Drop. With VSTO, you can add the different types of content controls to the document in the same way you'd add controls to a Windows Form: by dragging them from the Toolbox.
- Document Protection. Protecting parts of a document is easier than ever before. Instead of having to protect an entire document, and then make exceptions for certain areas, you can just specify the areas you want protected. Just use the Group content control on an area of the document that you don't want users to edit. You can also protect individual content controls so that they cannot be edited — and/or deleted — by setting the LockContents and LockContentControl properties in the Properties window.
- Forms. Using content controls in your document allows you to help users format documents or fill in forms easily. Add a Date Picker content control to ensure the correct date format is entered; add a Combo Box content control to give users choices.
- Printing. The control is not visible on the document until you need it to be. When you hover your mouse pointer over the control, it becomes highlighted, to indicate there's a control there.
When you select it, the control outline appears . . .
When you exit, the outline of control disappears. What's more, the controls never appear when you print the document. (You can use placeholder text as a visual cue to the user that the control exists).
- Data binding. You can bind data sources to content controls, so the control will get and display the latest data when the document is opened. Data sources can include fields in a database or XML parts that are stored in the document.
- Events. You can perform actions when a user selects a content control, edits it, or tries to delete it. Additional events related to data binding are also available.
Be sure to check out these content controls in VSTO Beta 2!
--Kathleen