Problem with adding page
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.
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
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;