How to refresh composite reports?

edited 3:40PM in FastReport 4.0
I have a composite report containing three reports which I preview in a custom preview form. It is created with frxReport.PrepareReport setting ClearOldRpt to True for the first report and false for the next two. This displays correctly with all three reports showing on the preview however if I print or export the report it disappears from the preview screen. The report is still there somewhere since I can scroll through the pages and although the preview screen is blank the page size changes as it goes to portrait or landscape pages and if I print again I get all pages from all reports printed.

How can I refresh the preview so it is visible again? frxPreview.Refresh does nothing and frxPreview.RefreshReport deletes the first two reports and displays the third. Closing the preview form and reopening it with frxReport.ShowPreparedReport just shows a blank preview form as well.

Comments

  • gpigpi
    edited 3:40PM
    frxReport1.Preview := nil;
    frxReport1.PrepareReport(True);
    frxReport1.PrepareReport(False);
    frxReport1.PrepareReport(False);
    frxReport1.Preview := frxPreview1;
    frxReport1.ShowPreparedReport;
  • edited 3:40PM
    gpi wrote: »
    frxReport1.Preview := nil;
    frxReport1.PrepareReport(True);
    frxReport1.PrepareReport(False);
    frxReport1.PrepareReport(False);
    frxReport1.Preview := frxPreview1;
    frxReport1.ShowPreparedReport;
    Thanks - that does work but I am surprised I have to recreate all the reports. Why aren't they still in memory somewhere so I can just reshow them ?

    I have a similar issue trying to print one page from a prepared composite report. The only solution I can get working is to delete all the other pages, print the page left, then recreate the whole report again unless somebody can tell me I have missed some option somewhere.
  • gpigpi
    edited 3:40PM
    frxPreview1.Lock;
    frxReport1.Print;
    frxPreview1.UnLock;

    or

    frxReport1.PreviewPages.Print;
  • edited 3:40PM
    gpi wrote: »
    frxPreview1.Lock;
    frxReport1.Print;
    frxPreview1.UnLock;

    Many thanks for that - works perfectly and feels a much better solution than recreating the report.

    Is there a way to print one page from the report and keep the whole report available for preview? At the moment I delete all the pages except the one in view, print the remaining report (ie one page)then recreate the report which does not feel at all like a good solution other than it works.
  • gpigpi
    edited 3:40PM
    frxReport1.PrintOptions.PageNumbers := '2';
  • edited 3:40PM
    gpi wrote: »
    frxReport1.PrintOptions.PageNumbers := '2';
    I already tried that - it does not work and get all pages printed whatever value I give to PageNumbers. Remember that I have already created the report and it is being viewed in a preview screen and I want to print just one page out of (say) 8 pages in a prepared composite report.
  • gpigpi
    edited 3:40PM
    wrote:
    I already tried that
    Show your code
  • edited June 2013
    gpi wrote: »
    gpi wrote: »
    I already tried that
    Show your code

    procedure TPrintPreviewFm.BtnPrintPageClick(Sender: TObject);
    begin
    frxPreview.Lock;
    MainView.frxReport.PrintOptions.PageNumbers := IntToStr(frxPreview.PageNo);
    if YNPrint.Ticked then MainView.frxReport.Print;
    if YNpdf.Ticked then MainView.frxReport.Export(frxPDFexport);
    frxPreview.Unlock;
    end;

    This procedure is on the preview form. frxReport and frxPDFexport and the code for frxUserDataSet1GetValue are on the main form (MainView) because they are accessed from several different places (not just the preview form). I have also tried hard coding the page as '3', and frxPreview.Print. The user will not know which single page they want until after looking at the preview since the program is a complex monte carlo simulation and they need to look at the output to see if they want it all or just some of it. The preview is a composite report made up from 2, 3 or 4 separate reports.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.