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

Save method

Saves changes to the Workbook. Returns 1 if it succeeds.

Syntax

function Save: Integer;

Example

This example creates a new Workbook with one Worksheet and then saves the Workbook.

Var
  Workbook: IXLSWorkbook;
begin
  Workbook := TXLSWorkbook.Create; {create new Workbook}
  Workbook.Worksheets.Add; 
  Workbook.SaveAs('book.xls');
  Workbook.Sheets[1].Name := 'NewName';
  Workbook.Save; //save to book.xls
end;
This example opens book.xls, changes the name of sheet one and then saves the Workbook to the same file.

Var
  Workbook: IXLSWorkbook;
begin
  Workbook := TXLSWorkbook.Create; 
  Workbook.Open('book.xls');
  Workbook.Sheets[1].Name := 'NewName';
  Workbook.Save; //save to book.xls
end;
Copyright©2007-2019 loslab.com