TAdvStringGrid
Example 66 : Using OnPrintNewPage to start a new page for new data in a column

In this simple OnPrintNewPage event handler, the first normal column value of the row that is to be printed is compared with the previous value and when different, a new page is caused by setting the parameter NewPage = true:
procedure TForm1.AdvStringGrid1PrintNewPage(Sender: TObject; ARow: Integer; var NewPage: Boolean); begin NewPage := false; if (ARow > 1) then NewPage := (AdvStringGrid1.Cells[0, ARow - 1] <> AdvStringGrid1.Cells[0, ARow]); end;
This shows how with a very little code, the page breaks during grid printing can be programmatically controlled.
Delphi project & source files for downloading included in the main demos distribution for Delphi.
×