unit VirtualGrid;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  BaseForm, AnyPrint, AnyGrids, ComCtrls, Buttons, ExtCtrls;

type
  TfrmVirtualGrid = class(TfrmBase)
    procedure FormCreate(Sender: TObject);
    procedure AnyGridGetText(Sender: TObject; Row, Col: Integer;
      var Text: WideString);
    procedure AnyGridSetText(Sender: TObject; Row, Col: Integer;
      var Text: WideString);
  private
    { Private declarations }
  protected
    procedure InitReport(Report:TAnyPrint);override;    
  public
    { Public declarations }
  end;

var
  frmVirtualGrid: TfrmVirtualGrid;

implementation

{$R *.DFM}
var
  Datas:array of array of string;

procedure TfrmVirtualGrid.FormCreate(Sender: TObject);
var
  i,j:integer;
begin
  inherited;
  SetLength(Datas,AnyGrid.Rows);
  for i:=1 to AnyGrid.Rows do
  begin
    SetLength(Datas[i-1],AnyGrid.Cols);
    for j:=1 to AnyGrid.Cols do
      Datas[i-1,j-1]:=Format('%d-%d',[i,j]);
  end;    
end;

procedure TfrmVirtualGrid.AnyGridGetText(Sender: TObject; Row,
  Col: Integer; var Text: WideString);
begin
  inherited;
  Text:=Datas[Row,Col]
end;

procedure TfrmVirtualGrid.AnyGridSetText(Sender: TObject; Row,
  Col: Integer; var Text: WideString);
begin
  inherited;
  Datas[Row,Col]:=Text;
end;

procedure TfrmVirtualGrid.InitReport(Report: TAnyPrint);
begin
  Report.PageFooter.RightText:=Report.PageFooter.RightText+#13#10'[PAGE#] of [TOTALPAGES]';//Display PageNo at RightBottom
end;

end.
  