ExportToExcel Method
Applies To
fpSpread control
Description
Exports the sheet to a sheet in an Excel-formatted file.
Syntax
BOOL CSpreadSheet::ExportToExcel(LPCTSTR FileName, LPCTSTR SheetName, LPCTSTR LogFileName);
fpSpread.ExportToExcel(ByVal FileName As String, ByVal SheetName As String, ByVal LogFileName As String) As Boolean
Parameters
The following parameters are available:
Parameter | Description |
FileName | Path and file name of Excel-formatted file to create |
SheetName | Name of the sheet to create in the file |
LogFileName | Path and file name of log file to create If you do not provide a file name, the export will not create a log file. If you do not want to create a log file, set this parameter to "". |
Remarks
Use this method to export the sheet to a sheet in an Excel-formatted file. The file to which you export will be in the BIFF8 format, which is the format used by Excel 97, Excel 2000, and Excel 2002. Avoid using characters in the sheet name that Excel considers invalid such as ? / \ * [ ].
This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.
When you export the sheet, you can choose to have Spread create a log file that details how certain data and cell characteristics are handled during the export. To have Spread create an export log file, specify the path and file name in the LogFileName parameter. If you do not specify a path, Spread will place the log file in the current drive and directory.
By default, Excel-formatted files created using Spread or the Spread Designer have the extension .XLS. However, you may use any extension.
Tip: You might want to save to a Spread (.SS8) file in addition to exporting it to Excel so that you can open the Spread (.SS8) file for future modifications. |
The following table summarizes the formats to which you can save data from a workbook or sheet:
To Save To . . . | Use Method |
---|---|
Binary file (proprietary format) | SaveToFile |
Tab-delimited file | SaveTabFile or SaveTabFileU |
Delimited file (offers user-defined delimiters) | ExportToTextFile or ExportRangeToTextFile or ExportToTextFileU or ExportRangeToTextFileU |
Excel-formatted file | ExportExcelBook, ExportExcelBookEx, ExportToExcel, or ExportToExcelEx |
HTML file | ExportToHTML or ExportRangeToHTML |
XML file | ExportToXML or ExportRangeToXML |
XML buffer | ExportToXMLBuffer or ExportRangeToXMLBuffer |
An array | GetArray |
For instructions and more information about exporting Excel-formatted files, see Exporting to an Excel-Formatted File and Excel-Formatted File Import/Export (online PDF manual). Excel-Formatted File Import/Export includes a list and description of the log message numbers.
If you want to import an existing Excel-formatted file, use the GetExcelSheetList, ImportExcelSheet, and IsExcelFile methods.
Return Type
True if successful; otherwise, False.
See Also
Exporting to an Excel-Formatted File
Excel-Formatted File Import/Export (online PDF manual)
Sheet property
GetExcelSheetList, ImportExcelSheet, IsExcelFile methods
DLL Correspondence
SSExportToExcel function