Office Automation Sample
This sample demonstrates automation of Microsoft Agent, Microsoft Word, and Microsoft Excel. When referencing the various COM Office assemblies, Visual Studio automatically creates COM runtime callable wrappers (RCW) so you can program against them from within the .NET Framework.
To get samples and instructions for installing them
Do one or more of the following:
On the Help menu, click Samples.
The Readme displays information about samples.
Visit the Visual Studio 2008 Samples Web site. The most recent versions of samples are available there.
Locate samples on the computer on which Visual Studio is installed. By default, samples and a Readme file are installed in drive:\Program Files\Microsoft Visual Studio 9.0\Samples\lcid. For Express editions of Visual Studio, all samples are located online.
For more information, see Visual Studio Samples.
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.
To run this sample
If you want to hear Merlin speak, you may need to install the speech recognition pack, which is included with Microsoft Office XP but not installed by default. For instructions on how to do this, see: Install speech recognition (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/input_speech_install.mspx).
Microsoft Agent The Office Agent library makes the Merlin character appear and perform. Before the Merlin character can appear, an instance of the AgentObjects.Controller object must be created. From this object, an IAgentCtlCharacter object is accessed that represents Merlin. The IAgentCtlCharacter implements a Play method that is used to control the various animations. For more on Microsoft Agent, see the articles and SDK documentation at http://msdn.microsoft.com.
Microsoft Excel Create and fill a DataSet from an XML document and then use the DataBind method to bind it to a DataGrid. Then export the contents of the DataSet to an Excel spreadsheet and run an Excel function that calculates the average of the values in a column.