Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the contents of the entire open workbook.
Namespace: Microsoft.Office.Excel.Server.WebServices
Assembly: Microsoft.Office.Excel.Server.WebServices (in Microsoft.Office.Excel.Server.WebServices.dll)
Syntax
'Declaration
<WebMethodAttribute> _
Public Function GetWorkbook ( _
sessionId As String, _
workbookType As WorkbookType, _
<OutAttribute> ByRef status As Status() _
) As Byte()
'Usage
Dim instance As ExcelService
Dim sessionId As String
Dim workbookType As WorkbookType
Dim status As Status()
Dim returnValue As Byte()
returnValue = instance.GetWorkbook(sessionId, _
workbookType, status)
[WebMethodAttribute]
public byte[] GetWorkbook(
string sessionId,
WorkbookType workbookType,
out Status[] status
)
Parameters
sessionId
Type: System.StringThe Excel Web Services session ID.
workbookType
Type: Microsoft.Office.Excel.Server.WebServices.WorkbookTypeDefines the different modes (Full Workbook, FullSnapshot, and PublishedItemsSnapshot) used to get a workbook. Also see the WorkbookType enumerator.
status
Type: []Alert information.
Return Value
Type: []
The entire workbook loaded in the session.
Remarks
This method returns a byte array, with the same file format that was loaded into the session. Supported file formats are *.xlsx, *.xlsb, and *.xlsm.
Examples
// Instantiate the Web service
ExcelService xlSrv = new ExcelService();
Status[] status;
// Set the credentials for requests
// In this example, the default credentials are used
xlSrv.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Open the workbook, call GetWorkbook and close the session.
string sessionId = xlSrv.OpenWorkbook(args[0], "en-US", "en-US", out status);
byte[] wb = xlSrv.GetWorkbook(sessionId, WorkbookType.FullSnapshot, out status);
status = xlSrv.CloseWorkbook(sessionId);