TdxCustomSpreadSheet.SaveToFile(string) Method
Saves workbook data and concomitant settings to a file.
Declaration
procedure SaveToFile(const AFileName: string); virtual;
Parameters
Name | Type |
---|---|
AFileName | string |
Remarks
This procedure creates a file stream and calls the SaveToStream procedure. The AFileName parameter specifies the path to the file that will store the saved spreadsheet document. The file name extension determines the saved document file format. Currently, the SaveToFile procedure can export the spreadsheet data and accompanying settings into the following file formats:
XLSX (modern Microsoft Excel® spreadsheet document format);
XLTX (modern Microsoft Excel® spreadsheet template format);
XLS (old Microsoft Excel® spreadsheet document format);
XLT (old Microsoft Excel® spreadsheet template format);
CSV (the comma separated values format);
TXT (the plain text file format);
HTML and HTM (the hypertext markup language file format);
XML (the extensible markup language file format);
The ExpressSpreadSheet binary format, represented by the data stream, saved into a file (to use this format, do not add an extension to a specified file name).
Calling the SaveToFile procedure raises the OnProgress event multiple times on reaching certain inner marks dependant on the file format, allowing you to track the file saving progress.
To allow end-users to export the Spreadsheet or Report Designer control content to any supported file format, you can manually link the SaveDocumentAs command to a UI element in your application or use the control’s automatic Toolbar or Ribbon UI generation feature.
Note
If you export a document into the CSV, TXT, HTML, HTM, or XML file formats, the SaveToFile procedure saves only the cell data from the currently active worksheet. CSV and TXT files, due to the natural limitations of these formats, can store only cell data, without accompanying information on styles, decorations, embedded floating objects, etc.
The CSV file format settings, applied to all Save/Load operations, can be customized by calling the dxSpreadSheetCSVFormatSettings function declared in the dxSpreadSheetFormatCSV unit.