ExcelService.SaveWorkbookCopy Method
Saves a workbook using a different file name and/or to a different SharePoint document library.
Namespace: Microsoft.Office.Excel.Server.WebServices
Assembly: Microsoft.Office.Excel.Server.WebServices (in Microsoft.Office.Excel.Server.WebServices.dll)
Syntax
'Declaration
<WebMethodAttribute> _
Public Sub SaveWorkbookCopy ( _
sessionId As String, _
workbookPath As String, _
workbookType As WorkbookType, _
saveOptions As SaveOptions, _
<OutAttribute> ByRef status As Status() _
)
'Usage
Dim instance As ExcelService
Dim sessionId As String
Dim workbookPath As String
Dim workbookType As WorkbookType
Dim saveOptions As SaveOptions
Dim status As Status()
instance.SaveWorkbookCopy(sessionId, _
workbookPath, workbookType, saveOptions, _
status)
[WebMethodAttribute]
public void SaveWorkbookCopy(
string sessionId,
string workbookPath,
WorkbookType workbookType,
SaveOptions saveOptions,
out Status[] status
)
Parameters
sessionId
Type: System.StringThe Excel Web Services session ID.
workbookPath
Type: System.StringThe location of the workbook file to open. Must be an absolute path.
Maximum size is 4096 characters.
workbookType
Type: Microsoft.Office.Excel.Server.WebServices.WorkbookTypeDefines the different modes (Full Workbook, FullSnapshot, and PublishedItemsSnapshot) used to get a workbook. Also see the WorkbookTypeenumerator.
saveOptions
Type: Microsoft.Office.Excel.Server.WebServices.SaveOptionsSpecifies whether to overwrite an existing file. If true to overwrite; otherwise false.
status
Type: []Alert information.
Remarks
This method only saves to a SharePoint document library in the same domain. The workbookPath cannot be a UNC file path. The document library must be a trusted location. This method works in view or in edit mode.
You can specify the workbook file format (.xlsx, .xlsb, .xlsm) as part of the file name. This method does not close the session. To close the session, you must explicitly call the CloseWorkbook(String, []) method.
This method preserves the workbook settings on recalculation before saving the workbook. To change workbook settings, use the SetCalculationOptions(String, WorkbookCalculation, []) method.