Problem with adding page

edited 7:53AM in FastReport 4.0
Hi,

I have report with many pages and trying to export it to PDF one by one, not all pages I have in one PDF.

So here is what I am trying to do:
//
Stream:= TMemoryStream.Create;
for i:= 0 to frxReport.PreviewPages.Count - 1 do
begin
Stream.Clear;
frxExport.Clear;

frxReport.PreviewPages.Page.SaveToStream(Stream);
Stream.Position:= 0;
frxExport.PreviewPages.LoadFromStream(Stream);
frxExport.ShowPreparedReport;
end;
Stream.Free;

/^^^^^^^^^^^^^
I get empty report.


for i:= 0 to frxReport.PreviewPages.Count - 1 do
begin
frxExport.Clear;
frxExport.PreviewPages.AddPage(frxReport.PreviewPages.Page);
frxExport.ShowPreparedReport;
end;

/^^^^^^^^^^^^^^^
I get error "List index out of bounds (-1)", seems like addpage doesnt work.

So, any suggestions how to load from report with many pages to other report only one page or maybe there is other way to export pages one by one.

Thanks.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:53AM
    what is frxexport?
    previewpages can only be added from one Tfrxreport component to another Tfrxreport
    Also the report component to which the pages are being added must already contain one prepared preview page before any preview pages can be added to it
  • edited 7:53AM
    gordk wrote: »
    what is frxexport?
    previewpages can only be added from one Tfrxreport component to another Tfrxreport
    Also the report component to which the pages are being added must already contain one prepared preview page before any preview pages can be added to it

    frxReport and frxExport are both TfrxReport; Its just name, because then I would try to export to PDF single page from frxExport: TfrxReport;

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.