Forum > LazReport

[Solved] How to conditionally print page 1 or page 2

(1/1)

JanRoza:
I hope someone can point me in the right direction.
I have a report in which I defined 2 pages (page1 and Page2).
In my program I have a checkbox where the user can choose to print only Page1 of the report or print Page1 and Page2.
But how do I get this done in lazReport, I now show the user the report via 'ShowReport' but I have no idea how to tell lazReport to show Page1 or Page1 and Page2.

paweld:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.PreviewButtonClick(Sender: TObject);begin  frReport1.LoadFromFile('myreport.lrf');  if frReport1.PrepareReport then  begin    if (RadioGroupSelectedPage.ItemIndex >= 0) and (RadioGroupSelectedPage.ItemIndex < frReport1.EMFPages.Count) then      frReport1.EMFPages.Delete(abs(1 - RadioGroupSelectedPage.ItemIndex));      frreport1.ShowPreparedReport;  end;end;  

JanRoza:
Thanks paweld,

That was what I was looking for!
I never knew what EMFPages was used for, so I learned something new again (never too old to learn).
Thanks for pointing me in the right direction.

Navigation

[0] Message Index

Go to full version