ExcelApplication Object Reference
Save Method
Syntax:
[VBScript]
Function Save([FileName],_
[saveMethod As SASaveMethod],_
[saveFormat As SAFileFormat = saFileFormatDefault], _
[Response])
Description:
The Save method generates a new spreadsheet and saves this
spreadsheet to disk, streams it to the client, returns it as an
ExcelTemplate object, or returns it in memory as an array of bytes.
Save takes three parameters:
FileName |
Physical path and file name of the new spreadsheet. |
|
SaveMethod |
Specifies whether to save the spreadsheet to disk,
open it in Excel, open it in the browser,
return an ExcelTemplate
object, or return the spreadsheet in memory as an array of bytes. |
Default value: 0 (saDefault) |
FileFormat |
Specifies whether to save the spreadsheet in
BIFF7 (Excel 95) or BIFF8 (Excel 97/2000) format. |
Default value: False |
Assign the SaveMethod parameter by number or name:
0 | saDefault | If a FileName
is assigned, the file will be
saved to disk.
If a FileName
is not assigned, the
file will be returned in
memory as a sequence of bytes. |
1 | saOpenInExcel | Open the file in Excel. |
2 | saOpenInPlace | Open in the browser. |
3 | saOpenAsTemplate | Return an ExcelTemplate
object.
saOpenAsTemplate type is deprecated in ASP.NET;
it returns the Interop version of the template object,
SAExcelTemplateClass. To return the pure .NET
ExcelTemplate object, use the method,
ExcelTemplate ExcelApplicationDotNet.Save();
saOpenAsTemplate is not
available in ExcelWriterSE, ExcelWriterLE, or ExcelWriterFree.
|
Assign the FileFormat parameter by name or number:
7 in V1.x
8 in V2 or later | saFileFormatDefault |
7 | saFileFormatExcel95 |
8 | saFileFormatExcel97 |
8 | saFileFormatExcel2000 |
8 | saFileFormatExcel2002 |
Returning an ExcelTemplate Object in ASP.NET
In ASP.NET, if you pass no parameters to Save the method returns
an ExcelTemplate object. |
Examples:
[VBScript]
'--- Save the spreadsheet with a path and file name
xlw.Save "c:\spreadsheets\workbook1.xls"
[VBScript]
'--- Allow the user to either save the file to disk,
'--- or open it from its current location.
Response.ContentType = "application/vnd.ms-excel"
Response.BinaryWrite(xlw.Save)
Top
Copyright © 2005, SoftArtisans, Inc.