Page header/footer

This code adds a user-defined page header and footer to the worksheet. Open a print preview to see the page header and footer.
uses
  {...}, OExport, OExport_Vcl, OExport_VclForms;

procedure TForm1.BtnTestClick(Sender: TObject);
var
  xExport: TOExport;
begin
  xExport := TOExport.Create;
  try
    with xExport.AddWorkSheet('Page Header/Footer') do begin
      with Header.Left do begin
        Text := 'Kluug.at';
        Font.Color := clRed;
        Font.Size := 18;
        Font.Name := 'Courier New';
      end;
      Header.Right.Text := 'Date: [DATE]';

      Footer.Center.Text := 'Page [PAGENUMBER] of [PAGECOUNT]';

      AddRow.AddCellString('Open a print preview to see the page header and footer');
    end;

    xExport.SaveToFileWithDialog;
  finally
    xExport.Free;
  end;
end;
Categories