Field-Map Scripting

4.6.4.11 InsertHPageBreak

InsertHPageBreak procedure


Prototype:

procedure InsertHPageBreak(const row :integer; const aGoesAfter :boolean);

Description:

Inserts an Horizontal Page Break at the specified row. If there is one already, it will do nothing. If the number of page breaks is bigger than the maximum Excel can admit, it will add it anyway, but you might get an exception when saving the file as xls. Exporting as images or PDF will use those additional page breaks.

Syntax:

xls.InsertHPageBreak( row, aGoesAfter);  


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class


row

Variable declared as integer that represents the row where to insert the page break. All row numbers are 1-based, and the breaks occur after the row.

Note that row can be 0, and this would mean a page break before row 1. (which Excel will ignore)


aGoesAfter

Variable declared as boolean. It is used to add page breaks that behave as if they affected the next row, not the row at the top.

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}

  xls.Landscape:=true;
  xls.SetPaperSize('A4');
  xls.SetPrintArea(1,1,Cols, Rows);
  xls.SetPrintMargins(25,25,20,25,10,10);
  xls.InsertHPageBreak(10,true);

  {making the sheet fit in one page of width }
  xls.PrintNumberOfHorizontalPages:=1; 
  xls.PrintToFit:=true;


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