Docs HotXLS

SaveAs-method

Saves the Worksheet in a file or stream. Returns 1 if it succeeds

Syntaxe

function SaveAs(FileName: WideString; FileFormat: TXLSFileFormat): Integer;
function SaveAs(Stream: TStream; FileFormat: TXLSFileFormat): Integer;
FileName WideString. Une chaîne qui indique le nom du fichier à enregistrer. Vous pouvez inclure un chemin complet ; sinon, le composant enregistre le fichier dans le dossier courant
FileFormat TXLSFileFormat. A value that indicates format of the file to be saved
Stream TStream. Saves to a stream specified in the Stream parameter

Description

FileFormat can be one of these TXLSFileFormat constants
xlRTF RTF file format
xlHTML HTML file format
xlCSV Comma separated values file format (CSV)
xlText Tab separated values file format (TSV)
xlUnicodeCSV Comma separated unicode values file format (CSV)
xlUnicodeText Tab separated unicode values file format (TSV)

Exemple

This example saves the Worksheet one as CSV file

Workbook.Sheets[1].SaveAs('sheet.csv', xlCSV);
This example saves the Worksheet one as RTF file

Workbook.Sheets[1].SaveAs('sheet.rtf', xlRTF);
This example saves the Worksheet one as HTML file

Workbook.Sheets[1].SaveAs('sheet.html', xlHTML);
This example saves the Worksheet one as TSV file

Workbook.Sheets[1].SaveAs('sheet.tsv', xlText);
This example saves the Worksheet one as unicode TSV file

Workbook.Sheets[1].SaveAs('sheet.tsv', xlUnicodeText);
This example saves the Worksheet one as unicode CSV file

Workbook.Sheets[1].SaveAs('sheet.csv', xlUnicodeCSV);