This documentation is archived and is not being maintained.

Data Model Overview

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005


    Visual Studio Team System

  • Microsoft Office 2003

A primary goal of Microsoft Visual Studio 2005 Tools for the Microsoft Office System solutions is to separate data from view in Office documents. Data refers to the information that is stored in the document: numbers, text, and so on. View refers to the user interface and the object model of the application (Microsoft Office Word or Microsoft Office Excel). A worksheet, as an example, is a collection of cells with properties such as value (which represents data) and font (which represents the view). The Excel object model provides access to the various properties and methods of cells (as well as ranges, worksheets, and other elements). However, beyond the ability to map XML schema to various cells and ranges, Excel and Word have no built-in concept of data, which is always embedded in the view.

Data Programming Model

Visual Studio Tools for Office separates the data from the view in Microsoft Office documents by enabling data to be embedded as an XML data island. You are able to separate view and data, and are able to update the data directly without writing code that touches the view. Typed data sets are used to provide a schema-oriented programming model for interacting with the data island. Data binding is used between the data island and the view to keep the two synchronized. You can also add validation code to the data that is independent of the document view components.

Programming directly to data by using an XML schema-based model means that code that works with data does not need to address the Excel and Word object models. Code does not rely as much on referring to specific cells, ranges and tables, which can be moved around by users. Rather, code directly accesses XML data islands.

Server Document Creation

The data island embedded in the document can be manipulated without starting the Office application. This is different than the current model, where in order for code to manipulate the contents of the document, Excel or Word has to be running. Having to run Word or Excel blocks a common solution requirement, that is, creating Office documents from an ASP.NET application.

The Visual Studio Tools for Office runtime is started on a server without running Excel or Word. The data island in a document can be manipulated from the server-side code. When the user opens the associated Office document the view is synchronized to the data island via data binding, and the user is presented with the updated data.

In this model, Excel and Word are not needed to write to the data on the server, only to view it on the client. Excel and Word do not even need to be installed on the server. This provides improved scalability and the ability to perform fast batch processing of documents containing data islands on the server.

Data Caching for Offline Use

Storing the data in a data island provides a mechanism for enabling offline scenarios. When a user first opens a document or requests the document from the server, the data island is filled with the most recent data. The data island is cached in the document and is then available offline. The user (and your code) can manipulate the data, even though no live connection is available. When the user reconnects, the changes to the data can be propagated back to a server data source.

See Also