Editare

Partajați prin


Manage documents on a server by using the ServerDocument class

You can use the ServerDocument class in the Visual Studio Tools for Office runtime to manage several aspects of document-level customizations, even if Microsoft Office Word and Microsoft Office Excel are not installed. You can perform the following tasks:

Understand the ServerDocument class

The ServerDocument class is designed to be used on computers that do not have Office installed. Therefore, you typically use this class in applications that do not integrate with Office, such as Console projects or Windows Forms projects, rather than Office projects. Use the ServerDocument class in the Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll assembly.

The ServerDocument class can be used to operate on document-level customizations that were created by using Visual Studio 2013.

For more information about the Visual Studio 2010 Tools for Office Runtime and the Office extensions for the .NET Framework, see Visual Studio Tools for Office runtime overview.

Note

If you have a legacy application that uses the ServerDocument class in the Visual Studio Tools for Office system (version 3.0 Runtime), the Visual Studio Tools for Office system (version 3.0 runtime) must be installed on computers that run the application. The Visual Studio 2010 Tools for Office runtime cannot run these applications.

Work with cached data in the document

The ServerDocument class provides members you can use to work with the data cache in customized documents. For more information about cached data, see Cache data and Access data in documents on the server.

The following table lists the members you can use to work with cached data.

Task Member to use
To determine whether a document has a data cache. The IsCacheEnabled method.
To access the cached data in a document.

For more information, see Access data in documents on the server.
The CachedData property.

Manage the document customization

You can use members of the ServerDocument class to manage the customization assembly that is associated with a document. For example, you can programmatically remove the customization from a document so that the document is no longer part of a customization.

The following table lists the members you can use to manage the customization assembly.

Task Member to use
To determine whether a document is part of a document-level customization. The GetCustomizationVersion method.
To programmatically attach a customization to a document at run time.

For more information, see How to: Attach managed code extensions to documents
One of the AddCustomization methods.
To programmatically remove a customization from a document at run time.

For more information, see How to: Remove managed code Extensions from documents.
The RemoveCustomization method.
To get the URL of the deployment manifest that is associated with the document. The DeploymentManifestUrl property.