Back to Devexpress

ASPxSpreadsheet.Open(String) Method

aspnet-devexpress-dot-web-dot-aspxspreadsheet-dot-aspxspreadsheet-dot-open-x28-system-dot-string-x29.md

latest2.5 KB
Original Source

ASPxSpreadsheet.Open(String) Method

Opens a document from a file system.

Namespace : DevExpress.Web.ASPxSpreadsheet

Assembly : DevExpress.Web.ASPxSpreadsheet.v25.2.dll

NuGet Package : DevExpress.Web.Office

Declaration

csharp
public void Open(
    string pathToDocument
)
vb
Public Sub Open(
    pathToDocument As String
)

Parameters

NameTypeDescription
pathToDocumentString

The path to a document to open.

|

Remarks

Call this Open method to open a document from the server’s file system. When you open a document for the first time, the control loads it to the server’s memory and generates a DocumentId from the pathToDocument parameter value.

If the document is already open, the method activates the document stored in the server’s memory.

csharp
string pathToDocument = Server.MapPath("~/App_Data/Documents/doc.xlsx");
ASPxSpreadsheet1.Open(pathToDocument);
vb
Dim pathToDocument As String = Server.MapPath("~/App_Data/Documents/doc.xlsx")
ASPxSpreadsheet1.Open(pathToDocument)

Specify the WorkDirectory property to enable the Open and Save As UI commands. Users cannot access the file system outside the specified directory.

Note

We recommend that you do not use the LoadDocument method to open a document. When you call this method, the ASPxSpreadsheet does not receive information about the opened document and cannot work with it correctly.

See Also

Open a Document

ASPxSpreadsheet Class

ASPxSpreadsheet Members

DevExpress.Web.ASPxSpreadsheet Namespace