Link Search Menu Expand Document

SSpread.ExportToExcelEx Method


HttpResponse class
Explanation Specify the sheet name and export to an Excel format file.

An extension of the ExportToExcel method. Method to handle the formulas can be specified.
The following specifications have been expanded since Ver.5.0.2->
By specifying an existing Excel file, it is possible to export in the form of 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.
Call format ExportToExcelEx(Writer, sheetname, [, URL or reader])
Return value None
Arguments Writer Export destination Writer Object
sheetname Sheet name to be created in the Excel file
flags Set whether to export formulas
Specify the following values.
Constant Value Description
$SS_EXCELSAVEFLAGNONE 0 Save the formula
$SS_EXCELSAVEFLAG_NOFORMULA 1 Do not save formulas
URL or Reader The URL of the Excel file to read, or the ReaderObject
It can be omitted. If specified a URL, the file will be cached on your local computer for faster loading from the next time onwards. The latest file can always be obtained from the server by specifying the HttpResponse object.
Added since Ver.5.0.2
Exception EXT-24 No valid Reader object specified
EXT-25 No valid Writer object specified
EXT-28 An error occurred in the ExportToExcelEx method
CRS-331 Communication error
Same as the exception to the NetObject.Get method.
Example of use
    var fs = new FileSystem();
    var f = fs.SaveDialog("Save", "Excel File(*.xls)=*.xls", "xls", "");
    ExportToExcelEx(f, "Sheet 1", $SS_EXCELSAVEFLAG_NOFORMULAS);
    f.Close();
    
Related item ExportExcelBookEx, ExportToExcel, ImportExcelSheet method