I have a multi-page report. How can I exclude a page from export at run time?You can't, it's much easier to exclude a page when you generate the report by filtering the dataset. However if you still wish to go with your idea, please take a look at ($LazarusDir)\components\lazreport\source\lr_class.pas, line 11215, you will see the following:
Hi calm_sea,Could he use a Class-Helper overriding that Procedure?QuoteI have a multi-page report. How can I exclude a page from export at run time?You can't, it's much easier to exclude a page when you generate the report by filtering the dataset. However if you still wish to go with your idea, please take a look at ($LazarusDir)\components\lazreport\source\lr_class.pas, line 11215, you will see the following:
procedure TfrReport.ExportBeforeModal(Sender: TObject); var i: Integer; begin if IsMainThread then Application.ProcessMessages; for i := 0 to EMFPages.Count - 1 do begin FCurrentFilter.OnBeginPage; EMFPages.ExportData(i); InternalOnProgress(i + 1); if IsMainThread then Application.ProcessMessages; FCurrentFilter.OnEndPage; end; FCurrentFilter.OnEndDoc; if frProgressForm<>nil then frProgressForm.ModalResult := mrOk; end;
The thing is you have to prevent the execution of EMFPages.ExportData(i) for a specific page i. There are many ways to implement this, like a public variable SkipPages. You also have to adjust the page count of the exported document.