Field-Map Scripting

4.6.5.1 AddSheet

AddSheet procedure


Prototype:

procedure AddSheet(const SheetName :string; const OverwriteSheet :boolean);  

Description:

Inserts an empty sheet at the end of the file. The name of the new sheet is as defined in the SheetName variable. If a sheet with the same name exists already and OverwriteSheet is set to true, the existing sheet is cleared first.  If a sheet with the same name exists already and OverwriteSheet is set to false, a new sheet with SheetName(2) is added.

Syntax:

xls.AddSheet('MyNewSheet',OverwriteSheet);  


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class


OverwriteSheet

Variable declared as boolean (True=overwrite, False=do not overwrite)

Return value:

none


See also:

AddSheet , MakeSheetActive , ClearSheet , Complex example



Example:

Var
  Row, Rows, Cols:integer;
  xls :TExcelWrapper;
Begin
  {document preparation}
  //...
  {managing worksheets}
  xls.AddSheet('My first sheet',true);
  xls.SetValue(1,1,'My first sheet','ColCaption','','');   
    
  xls.AddSheet('My second sheet',true);
  xls.SetValue(1,1,'My second sheet','ColCaption','','');
    
  xls.AddSheet('My third sheet',true);
  xls.SetValue(1,1,'My third sheet','ColCaption','','');    

  xls.ClearSheet('My first sheet');   xls.ClearSheet    
    
  xls.MakeSheetActive('My second sheet' ); 

  {document saving / previewing}
  //...
End.