Using Visual Studio Tools for Office in Visual Studio 2008, Page 3
Next, you will be asked to create a new document or use an existing document. Because you are going to import an existing template to this document, you will use this option. Select the second radio button and browse to the path of the template that I mentioned earlier (see Figure 4).
Figure 4: Select the second option, which allows you to reuse an existing template instead of creating a new blank document.
Click Finish to complete the initial stage; you now will be shown with the document inside of Visual Studio 2008, as shown in Figure 5. This is a new feature that allows the developer to preview and work with the document while writing code in .NET.
Figure 5: The Word document is previewed inside of your project in VS 2008; this is a new feature.
This completes the first part; the next part will create the panel to show the list of customers and bind them to the document. This requires that you understand the basics of Dataset, Table Adapter, and creating connections to a variety of data sources such as SQL Server 2005, SQL Express 2005, and MS Access. For this demo, you will be using SQL Express 2005 because it comes free and can be used on a desktop.
Now, create a typed dataset and refer that to the Customers table. This is because the first name, last name, Address, City, State, and Zip are all found in the Customers table.
Click the Server Explorer in Visual Studio 2008, right-click Data Connection, and click New Connection. This opens the Add Connection window, as shown in Figure 6. By now, most of you should be familiar with this because you have come across this in your development life cycle daily.
Figure 6: The Data Connection Wizard to establish a connection to the database and to be used in the Server Explorer.