Hide some pages when I do a print preview
The report I use, has 9 pages when I prepare it.
But when I use the next code, the pages 3 and 5 are visible when watching the print preview. Accordint to me that pages should be NOT visbile:
How can I hide some pages when I do a print preview?
But when I use the next code, the pages 3 and 5 are visible when watching the print preview. Accordint to me that pages should be NOT visbile:
 frm_ReportPreview := Tfrm_ReportPreview.Create(Application);
 frm_Reports.fstrp_Test.Preview := frm_ReportPreview.frPreview;
 if not frm_Reports.fstrp_Test.PrepareReport then
  ShowMessage('Not prepared!!!');
 frm_Reports.fstrp_Test.EMFPages.Pages[3].Visible := False;
 frm_Reports.fstrp_Test.EMFPages.Pages[5].Visible := False;
 frm_Reports.fstrp_Test.ShowPreparedReport;
 frm_ReportPreview.ShowModal;
How can I hide some pages when I do a print preview?
Comments
you can hide designpages but not produced pages.
regards
Don't call ShowReport directly, instead call PrepareReport;
Than this code: EMFPages[Index].Visible:=False;
Than ShowPreparedReport;
Regards:Alex
It's me again. I tried and the working code is:
R.PrepareReport;
R.EMFPages.Delete(DesiredPageIndex);
R.ShowPreparedReport;
Regards:Alex
Other way to hide a page is to set the visible := False before to prepared the report.
See in your example:
Luciano
be carefull when deleting emf pages by index number, if you are manipulating pages in the final pass of a 2 pass report due to freespace requirements, you will not know the correct emfpage index value untill after you have previewed the report.
regards
I think the most programs are not good designed. Because on the printdialog you almost never see the button: print preview.
I think that is very strange, because the user can there select a few options, for example he can choose to print only a couple of page by entering the page nummers.
When the user want a preview, he wants exaclty see what the printer will prints. So in my program, I have placed a preview button on the print dialog.
When the user press the preview button, he sees exactly what the printer will prints and that's why I need to hide some pages.