Field-Map Scripting

4.6.4.14 CreateTableOfContent

CreateTableOfContent procedure


Prototype:

procedure CreateTableOfContent(lst :TStringListWrapper);

Description:

Lists each sheet name and includes a hyperlink shortcut to the appropriate worksheet.

Syntax:

xls.CreateTableOfContent(lst);  


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class


lst

Variable declared asan instance of the TStringListWrapper class. It is a list of hyperlink shortcuts to the appropriate worksheet and sheet names delimited by |.

Return value:

none


See also:

Landscape , SetPrintMargins , SetHeader , SetFooter , SetHeaderAndFooter , SetFirstHeaderAndFooter , SetTitleRows , SetTitleRowsAndCols , InsertHPageBreak , InsertVPageBreak , CreateHeaderOfTableContent , CreateTableOfContent , AddBackToTableOfContent , SetPrintArea , RowCount , ColCount , Header and footer codes , Predefined paper sizes, KeepColsTogether, KeepRowsTogether, AutoPageBreaks, PrintNumberOfHorizontalPages, PrintNumberOfVerticalPages, PrintToFit, Complex example


Example:

Var
  Row, Rows, Cols:integer;
  xls :TExcelWrapper;
Begin
  {document preparation}
  //...
  {managing worksheets}
  {setting cell values}

  {------------------Sheet: Content ----}
  xls.AddSheet('',true);
  {Create table of content}
  xls.CreateHeaderOfTableContent;
  {Create list of items}       
  lst:=TStringListWrapper.Create;
  lst.Add(format('%s|%s',['My first content item','My first sheet']));
  lst.Add(format('%s|%s',['My second content item','My second sheet']));
  lst.Add(format('%s|%s',['My third content item','My third sheet']));
  xls.CreateTableOfContent(lst);    

  xls.AddSheet('My first sheet',true);
  //...
  xls.AddSheet('My second sheet',true);
  //...    
  xls.AddSheet('My third sheet',true);
  //...

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