Saves the workbook to the specified file. Returns 1 if it succeeds.
This example creates Example1.xls workbook and Example1.html with two worksheets which contain data from Table1 and Table2 datasets.
begin
Dataset2Excel1.Workbook := nil; //Clears workbook
//First dataset
Dataset2Excel1.WorkSheetName := 'Table1 sheet'; //Specifies the name for first worksheet
Dataset2Excel1.Dataset := Table1; //Specifies the dataset for export
Dataset2Excel1.ExportDataset;
//Second dataset
Dataset2Excel1.WorkSheetName := 'Table2 sheet'; //Specifies the name for second worksheet
Dataset2Excel1.Dataset := Table2; //Specifies the dataset for export
Dataset2Excel1.ExportDataset;
Dataset2Excel1.SaveAs('Example1.xls'); //Saves the created workbook into Example1.xls file
Dataset2Excel1.SaveAs('Example1.html'); //Saves the created workbook into Example1.html file
Dataset2Excel1.SaveAs('Example1.rtf'); //Saves the created workbook into Example1.rtf file
end;