Cheat Sheet

VSTO For Dummies

From VSTO For Dummies by Bill Sempf, Peter Jausovec

Visual Studio Tools for Office (VSTO) extends some of the existing objects in the Office object model. You can use the classes in VSTO namespaces for the Word and Excel application to add or extend the functionality.

Excel Namespace Classes for Extending the Office Object Model in VSTO

In VSTO, the Microsoft.Office.Tools.Excel namespace contains classes that are relevant to the Microsoft Office Excel application. Here are the class names, along with short descriptions:

  • Workbook: This class represents the Workbook object from the Excel object model.

  • Worksheet: Worksheet class extends the functionality of the Worksheet class from the Excel object model, exposes events, and acts as a container for controls.

  • ChartSheet: This class represents an Excel worksheet that contains only a chart.

  • Chart: Chart control represents a chart object and exposes events.

  • ListObject: ListObject control is used to display data in rows and columns.

  • NamedRange: A NamedRange control represents a range that has a unique name and exposes the following events: BeforeDoubleClick, BeforeRightClick, BindingContextChanged, Change, Deselected, Selected, SelectionChange.

Word Namespace Classes for Extending the Office Object Model with VSTO

The Microsoft.Office.Tools.Word namespace contains classes that represent objects in the Word object model. Here is a list of the class names, along with their descriptions, that you can use in VSTO to extend the Office Object Model:

  • Document: Document class represents the document in Word 2010.

  • Bookmark: Bookmark control represents the bookmark class from the Word object model. The bookmark control has a unique name, exposes events, and can be bound to data as well.

Windows Forms Controls in VSTO

VSTO contains two namespaces that hold classes that contain Windows Forms controls, which you can use on the Word documents or Excel worksheets. All controls in the Microsoft.Office.Tools.Word.Controls and Microsoft.Office.Tools.Excel.Controls namespaces are derived from the Windows Forms base classes and function in the same way as regular Windows Forms controls.

You can find the following controls in the Microsoft.Office.Tools.Word.Controls namespace:

Button HScrollBar MonthCalendar RichTextBox
CheckBox Label NumericUpDown TextBox
CheckedListBox LinkLabel PictureBox TrackBar
ComboBox ListBox ProgressBar TreeView
DataGridView ListView PropertyGrid VScrollBar
DateTimePicker MaskedTextBox RadioButton WebBrowser
DomainUpDown
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com