Creates a new Workbook. Exports
DBGrid to Worksheet. Saves the Workbook to the specified file. Returns 1 if it succeeds.
Syntax
function SaveDBGridAs( Filename: WideString): Integer;
FileName |
WideString. A string that indicates the name of the file to be saved. You can include a full path; if you don't, component saves the file in the current folder. |
Example
This example exports the DBGrid1 into Orders.xls Workbook and Orders.html file.
begin
GridToXLS1.Workbook := nil; //Clears Workbook
GridToXLS1.WorksheetName := 'Orders sheet'; //Specifies name for new Worksheet
GridToXLS1.DBGrid := DBGrid1; //Specifies the dbgrid for export
GridToXLS1.SaveDBGridAs('Orders.xls'); //Saves the dbgrid into Orders.xls
GridToXLS1.SaveDBGridAs('Orders.html'); //Saves the dbgrid into Orders.html
end;