ServerDocument::Document Property

 

Gets the byte array of an in-memory document that is loaded into the ServerDocument.

Namespace:   Microsoft.VisualStudio.Tools.Applications
Assembly:  Microsoft.VisualStudio.Tools.Applications.ServerDocument (in Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll)

public:
property array<unsigned char>^ Document {
	array<unsigned char>^ get();
}

Property Value

Type: array<System::Byte>^

The byte array of an in-memory document that is loaded into the ServerDocument.

Exception Condition
DocumentClosedException

The document has been closed.

This property returns a filled byte array if the ServerDocument was created by using the ServerDocument(array<Byte>^, String^) constructor that has a byte array parameter, or the ServerDocument(Stream^, String^) constructor that has a Stream parameter. Otherwise, this property returns an empty byte array.

Using this property enables you to make changes to a document and send it to a client without writing the document to disk.

The following code example uses the ServerDocument(array<Byte>^, String^) constructor to create a new ServerDocument from a byte array that contains an Excel workbook with the .xlsx file name extension. The example then uses the Document property to display the number of bytes in the document.

This example requires:

  • A console application project or some other non-Office project.

  • References to the following assemblies:

    • Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll and Microsoft.VisualStudio.Tools.Applications.Runtime.dll (if the project targets the .NET Framework 4 or the .NET Framework 4.5).

      or

    • Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll and Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll (if the project targets the .NET Framework 3.5).

  • Imports (for Visual Basic) or using (for C#) statements for Microsoft.VisualStudio.Tools.Applications and Microsoft.VisualStudio.Tools.Applications.Runtime namespaces at the top of your code file.

No code example is currently available or this language may not be supported.
Return to top
Show: