HotXLS Delphi Excel Read Write Library / Component Developers Guide loslab Inc.

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;
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 dataset Table1 into Orders.xls Workbook and Orders.html file.

begin
  DataToXLS1.Workbook := nil; //Clears Workbook
  DataToXLS1.WorksheetName := 'Orders sheet'; //Specifies name for new Worksheet
  DataToXLS1.Dataset := Table1; //Specifies the dataset for export
  DataToXLS1.SaveDatasetAs('Orders.xls'); //Saves the dataset into Orders.xls 
  DataToXLS1.SaveDatasetAs('Orders.html'); //Saves the dataset into Orders.html 
end;
Copyright©2007-2019 loslab.com