Export (0) Print
Expand All

Data in Office Solutions 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

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

Office documents are often used as repositories of data. In the past, this meant that you had to start the Office application to be able to get to the data. However, in Microsoft Office Word 2003 documents or Microsoft Office Excel 2003 workbooks that have Microsoft Visual Studio 2005 Tools for the Microsoft Office System customizations, data can be stored in an embedded data island that is accessible without starting Excel or Word.

Benefits of Separating the Data and the Document

A data island is an XML document containing data that is embedded in the Office document; the XML document can be accessed without instantiating the Office document. The data actually exists in two places—in the document and also in the separate embedded data island. Data binding is used between the data island and the document to keep them synchronized. If code that runs on the server modifies the data island, the Office document will be synchronized to the data island when the document is opened and the code behind the document runs.

This model offers several benefits:

Schema-Oriented Programming

Microsoft Visual Studio 2005 Tools for the Microsoft Office System uses typed data sets to provide a schema-oriented programming model for interacting with the data island. This enables you to add validation code to the data that is independent of the document. Separating the validation from the document makes the data validation code portable to other documents.

Cached Data

The data island is filled with data that can be used offline. When a cached data item in the document contains data, the document interacts with the data island. Data sources that are declared using the CachedAttribute attribute are persisted in the data island. For more information, see How to: Cache Data for Use Offline or on a Server.

Server-Side Data Access

The fact that the data island is externally accessible allows you to modify the data embedded in a document without instantiating Office, which enables fast batch processing of documents on the server. Note that only data that is in the cache is accessible, not all data in the document.

Filling a Document on the Server without Starting the Office Application

The data island embedded in the document can be filled on the server without starting the Office application. You create a document and associate the schema of the data with that document. The document is then stored on the server. Your server-side code, for example code behind an ASP.NET page, calls methods in the Visual Studio Tools for Office runtime to fill the data island. For more information, see Server-Side Access to Data in Documents Overview.

Exposing Data Embedded in a Document to ASP.NET Server Pages without Starting the Office Application

You can expose the data embedded in an Office document to ASP.NET server pages without starting the relevant Office application by creating a document and associating a data schema with that document. The document is then stored on the server. Code in an ASP.NET page can treat the document as a data source and can read and modify the embedded data island. Visual Studio Tools for Office provides components that can read the data island from a document, expose it to an ASP.NET page as a data source, and allow read and write access to the data. For more information, see How to: Retrieve Cached Data from a Workbook on a Server.

Editing a Document Offline

After the data island is filled from a connection to the server, the document can be used in a disconnected scenario such as traveling on an aircraft that does not feature network connectivity. The data in the data island is available and can be manipulated even though there is no live connection to the server. Changes made to the data island can be propagated back to a server data source once a connection is available. For more information, see Saving Data and How to: Cache Data for Use Offline or on a Server.

Data Security

If your solution connects to an external data source such as a database, Web service, or other server application, validate all input at the data source as well as in the document. Even data that is cached in the document might not be what you expect it to be, as it is accessible from outside the document. For the same reason, do not include data in the cache that you do not want users to see.

For guidelines around secure data handling, see Security and User Input and Creating Secure User Interfaces.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft