NativeExcel suite v2.x

SaveDatasetAs method

Creates a new workbook. Exports dataset to worksheet. Saves the workbook to the specified file. Returns 1 if it succeeds.

Syntax

function SaveDatasetAs( Filename: WideString): integer;
FileNameWideString. 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 dataset Table1 into Orders.xls workbook and Orders.html file.
begin
  Dataset2Excel1.Workbook := nil; //Clears workbook
  Dataset2Excel1.WorkSheetName := 'Orders sheet'; //Specifies name for new worksheet
  Dataset2Excel1.Dataset := Table1; //Specifies the dataset for export
  Dataset2Excel1.SaveDatasetAs('Orders.xls'); //Saves the dataset into Orders.xls 
  Dataset2Excel1.SaveDatasetAs('Orders.html'); //Saves the dataset into Orders.html 
end;
Copyright © NikaSoft 2004-2011