Поделиться через


Office Development Samples

Visual Studio includes sample applications that demonstrate how to use the Microsoft Office developer tools to create Office solutions. The code in these samples illustrates the syntax, structure, and techniques used to build Office solutions.

Locating Sample Files

To access samples from Visual Studio

  1. On the Help menu, click Samples.

  2. In the Samples on Disk section of the readme file, click local Samples folder. By default, the samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\1033 or drive:\Program Files (x86)\Microsoft Visual Studio 10.0\Samples\1033.

  3. Right-click the .zip file that contains the samples you want to open and then click Extract All to extract the samples to a folder of your choice.

For the most current samples, see the MSDN Developer Samples: Learn Through Code.

Security noteSecurity Note

Microsoft provides the included samples "AS IS" with no warranties. The code in the samples is provided just to illustrate concepts. The provided code may not meet security requirements for any specific environment. We recommend that you add security and error-handling code to your projects to make them as secure and robust as you deem appropriate.

Office Development Samples

Sample

Description

Excel Master Detail Data Sample

Demonstrates how to retrieve data from a relational database or XML file and use that data in Excel.

Excel Document Protection Techniques Sample

Demonstrates various techniques you can use to protect structural components of a worksheet to help to prevent users from accidentally deleting controls or otherwise changing important parts of your solution document.

Excel Data Analysis Sample

Demonstrates an inventory management application that executes data analysis tasks in Excel using list objects, pivot tables, and charts.

Word Task Pane Sample

Demonstrates how to create a basic custom task pane for Word.

Word Content Controls Sample

Demonstrates how to bind Word content controls to database fields.

Word Smart Tag Sample

Demonstrates how to create and use two kinds of smart tags: a standard smart tag and a custom smart tag that has complex recognition.

NoteNote
Smart tags are deprecated in Excel 2010 and Word 2010. For more information, see Smart Tags Overview.

Outlook Form Region RSS Reader Sample

Demonstrates how to use Outlook form regions to display the full content of articles from an RSS feed.

Ribbon Controls Sample

This sample demonstrates how to create a custom tab that appears on the Ribbon of an Excel worksheet. This custom Ribbon demonstrates most of the controls available in the Office Ribbon Controls group of the Visual Studio Toolbox.

UI Manager Sample

Demonstrates how to create a Ribbon customization, a custom task pane, and a custom form region for Outlook by implementing extensibility interfaces in an add-in. Each instance of the Ribbon, task pane, and form region can correctly communicate with each other.

VBA and VSTO Interoperability Sample

Demonstrates how to call a method in a document-level customization for Excel from Visual Basic for Applications (VBA) code in the workbook.

This sample is only available online.

See Also

Concepts

Common Tasks in Office Programming

Other Resources

Visual Studio 2010 Samples