Link Search Menu Expand Document

SSpread.SaveExcel2007File Method

Explanation Specify the sheet name and export it to an Excel 2007 format file. Method to handle the formulas can be specified.

By specifying an existing Excel 2007 format file, it is possible to export by adding a sheet to the existing file. At that time, the existing file is not changed and is saved as a new Excel file with the sheet added. In addition, information other than sheets such as macros and graphs that exist in the existing Excel file will be deleted.

Notes on use
The Excel file output by this method is not a complete guarantee of compatibility with sheets created in Excel. Also, for better compatibility, it is recommended to save in Excel 2003 format.

Added since Ver.5.0.2
Call format SaveExcel2007File(Writer, password, flags[, sheetname[, URL or Reader]])
Return value None
Arguments Writer Export to Writer Object
password Workbook protection password. Null or "" (empty string) if not needed
flags Set whether to export formulas
Specify the following values.
Constant Value Description
$SS_EXCELSAVEFLAGNONE 0 Save the formula
$SS_EXCELSAVEFLAG_NOFORMULAS 1 Do not save formulas
sheetname Sheet name to be created in the Excel file. Optional.
URL or Reader URL of Excel 2007 format file to read, or Reader Object

The file will be cached on local computer for faster loading from the next time onwards if URL is specified. The latest files can be acquired from the server by specifying an HttpResponse object.
Exception EXT-25 No valid Writer object specified
EXT-28 An error occurred in the SaveExcel2007File method
Example of use
    var fs = new FileSystem();
    var f = fs.SaveDialog("Save", "Excel2007 File(*.xlsx)=*.xlsx", "xlsx", "");
    SaveExcel2007File(f, "Biz", $SS_EXCELSAVEFLAG_NOFORMULAS, "Sheet 1");
    f.Close();
    
Related item IsExcel2007File, OpenExcel2007File methods
HttpResponse class