| FileName | WideString. Una stringa che indica il nome del file da salvare. È possibile includere un percorso completo; in caso contrario, Workbook salva il file nella cartella corrente |
| FileFormat | TXLSFileFormat facoltativo. Un valore che indica il formato del file da salvare. Il valore predefinito è xlExcel97 |
| Stream | TStream. Saves Workbook to a stream specified in the Stream parameter |
L'output in file XLS completa la serializzazione in un file di staging sibling prima di sostituire la destinazione; un commit fallito lascia intatta la destinazione esistente e riporta l'errore nativo catturato attraverso la diagnostica del workbook
Su filesystem Windows che supportano la rename POSIX, la sostituzione può riuscire mentre resta aperto un handle di metadata o di lettura che consente l'eliminazione; un lettore esistente continua a vedere l'oggetto file originale, e un nuovo lettore del nome di destinazione vede la sostituzione completata
La destinazione deve consentire l'accesso delete e la condivisione delete, e i target readonly continuano a essere rifiutati; un commit fallito non viene ritentato, mentre target mancanti, percorsi reparse e filesystem non supportati usano il percorso di commit legacy selezionato prima della sostituzione
La sostituzione atomica protegge la pubblicazione di un file completato; non fornisce isolamento compare-and-swap contro un altro processo che sostituisce concorrentemente lo stesso nome
| xlExcel97 | MS Excel 97,2000,XP,2003 file format |
| xlExcel5 | MS Excel 5,95 file format |
| xlHTML | HTML file format |
| xlRTF | Rich Text Format (RTF) |
| 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) |
Var
Workbook: IXLSWorkbook;
begin
Workbook := TXLSWorkbook.Create; {create new Workbook}
Workbook.Worksheets.Add;
{...}
//Save Workbook as Excel 97 file format
Workbook.SaveAs('C:\book.xls');
//Save Workbook as Excel 5-95 file format
Workbook.SaveAs('C:\book5.xls', xlExcel5);
//Save Workbook as HTML
Workbook.SaveAs('C:\book.html', xlHTML);
//Save Workbook as RTF file
Workbook.SaveAs('C:\book.rtf', xlRTF);
//Save active Worksheet as comma separated values (CSV)
Workbook.SaveAs('C:\book.csv', xlCSV);
//Save active Worksheet as tab separated values (TSV)
Workbook.SaveAs('C:\book.tsv', xlText);
//Save active Worksheet as comma separated unicode values (CSV)
Workbook.SaveAs('C:\book.csv', xlUnicodeCSV);
//Save active Worksheet as tab separated unicode values (TSV)
Workbook.SaveAs('C:\book.tsv', xlUnicodeText);
end;
var
MS: TMemoryStream;
begin
if not (ClientDataSet1.State in [dsInsert, dsEdit]) then
ClientDataSet1.Insert;
MS := TMemoryStream.Create();
try
FWorkbook.SaveAs(MS);
ClientDataSet1Documents.LoadFromStream(MS);
finally
MS.Free;
end;
ClientDataSet1.Post;
end;