Saves the Workbook to the specified file. Döndürür 1 if it succeeds
File names ending in .xlsx are written through the XLSX
export bridge; .xls, .html, and
.rtf continue to use the classic exporters
Sözdizimi
function SaveAs(Filename: WideString): Integer;
| FileName |
WideString. Kaydedilecek dosyanın adını belirten string. Tam yol içerebilir; içermiyorsa bileşen dosyayı geçerli klasöre kaydeder |
Örnek
Bu örnek, DBGrid1 ve DBGrid2'den veri içeren iki çalışma sayfalı Example1.xls çalışma kitabını ve Examle1.html dosyasını oluşturur
begin
GridToXLS1.Workbook := nil; //Clears Workbook
//First dbgrid
GridToXLS1.WorksheetName := 'DBGrid1 sheet'; //Specifies the name for first Worksheet
GridToXLS1.DBGrid := DBGrid1; //Specifies the dbgrid for export
GridToXLS1.ExportDBGrid;
//Second dbgrid
GridToXLS1.WorksheetName := 'DBGrid2 sheet'; //Specifies the name for second Worksheet
GridToXLS1.DBGrid := DBGrid2; //Specifies the dbgrid for export
GridToXLS1.ExportDBGrid;
GridToXLS1.SaveAs('Example1.xls'); //Saves the created Workbook into Example1.xls file
GridToXLS1.SaveAs('Example1.xlsx'); //Saves the created Workbook into Example1.xlsx file
GridToXLS1.SaveAs('Example1.html'); //Saves the created Workbook into Example1.html file
GridToXLS1.SaveAs('Example1.rtf'); //Saves the created Workbook into Example1.rtf file
end;