Report to screen fine, Infinite Pages when send to printer
I've read the tech article on this but it didn't seem to help... My
situation is like this:
I have a subreport in a region. The subreport is statically linked to a
pipeline. The main report is linked to another pipeline.
The reports previews fine (in the designer, on the preview tab). What
happens next is _very_ odd...
Every other (alternate) attempt to print hardcopy from the previewer causes
the report status window to toggle back and forth between page 0 and -1,
very fast, such that about 500 blank pages are generated per second. If I
cancel out of the report, then click print again, the hardcopy comes out
fine. The next attempt gives me the blank pages again.
Any thoughts on what might cause this?
Keith
situation is like this:
I have a subreport in a region. The subreport is statically linked to a
pipeline. The main report is linked to another pipeline.
The reports previews fine (in the designer, on the preview tab). What
happens next is _very_ odd...
Every other (alternate) attempt to print hardcopy from the previewer causes
the report status window to toggle back and forth between page 0 and -1,
very fast, such that about 500 blank pages are generated per second. If I
cancel out of the report, then click print again, the hardcopy comes out
fine. The next attempt gives me the blank pages again.
Any thoughts on what might cause this?
Keith
This discussion has been closed.
Comments
Which version of ReportBuilder/Delphi are you currently using? We have not
had any issues like this one in the past. As a test, try commenting out all
your event handlers and re-run your report. If you still get the error,
please send a small example demonstrating the behavior in .zip format to
support@digital-metaphors.com and I'll take a look at it for you.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
It will be difficult to send you an example program... Report templates are
pulled from an SQL Server db, the report has 6 subreports, 5 of which get
freed depending on user selections. I had hoped you'd have seen something
like this before and could provide some ideas... It will be faster for me to
re-write using simpler design rather than spend the time to re-create the
problem in a program I can send you...
Keith
Usually when the report shows up fine on screen but breaks when it is sent
to the printer, the problem is some event handler code that is being
executed either only when the report is printed or in addition to some code
that has already been executed. This is why I recommended that you
disconnect all your event handler code so that you might be able to isolate
the problem. If, for instance, you do not free the 5 subreports or perhaps
you simply exclude them from the report design all together, does the
problem still persist?
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
called in order for both preview and print, until the first var calc... The
var calc is never reached and I begin getting the infinite pages...
Another oddity is that 4 of the 6 subreports work fine. Two do not... One of
the two broken subreports itself contains a subreport, the other contains
only an image component that is loaded from a db field from the detail
table.
I will report back here if I have more details.
When preview comes up I get "Page 1 of 2" in bottom left of preview window.
Try to print hardcopy and get flashing between 0 and -1.
Click on next/prev page in toolbar and page changes correctly.
Try to print hardcopy again and get flashing between 0 and -1.
Cancel from status window.
Try to print hardcopy again and it comes out okay.
NOW, try to click on next in toolbar and bottom left says, "Calculating
page -1 for report Report."
What would cause RB to try to print a page -1?
beforePrint event I free the embedded subreport the report prints fine...
beforePrint event I open the dataset linked to the subreport's pipeline.
Is there a problem opening a dataset linked to a pipeline in the report's
beforePrint event? I will try moving the opening of the datasets to see if
that solves the problem.
Also, back to the subreport within subreport problem, it is not enough to
set visible to false on the embedded subreport... i still get the problem in
that case. I have to free the subreport and then the report works
everytime...
As a rule of thumb, it is never a good idea to open and/or alter a dataset
connected to a report during report generation. This generally causes the
report engine to become lost in traversal and will give you incorrect
output.
When setting a subreport's visible property to false, the subreport will
still try to access the datapipeline it is connected to. You might try
disconnecting the pipeline after you set the visibility of the subreport and
see if that helps.
ppSubreport1.Visible := False;
ppSubreport1.DataPipeline := nil;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
my problem...
Apparently the report's beforePrint event is not a good place to open
datasets referenced by subreport pipelines. I moved the opening/closing of
datasets before/after the call to rbDesigner.showModal and now all works
correctly.
Thanks for the feedback.