I have a report that runs fine in preview, but when i try to print it from the preview screen blank paper comes out of the printer. Did i turn something off by mistake?
Try setting Report.CachePages to true. What may be happening is that your event handlers are refiring, as they always do when generating for the printer unless CachePages is set to true after a screen preview of the report. Are you event handlers prepared for this? You may have to reinitialize delphi variables that you are using before the report prints to any device.
Disconnect your event handlers for the report until the problem goes away. This way you'll be able to isolate what piece of the puzzle is affecting the data or the report band visibilties if you are setting those.
Another test is to simply connect a repot to the data pipeline and create a main report using the report wizard and print that to the printer without any code other than a Report.Print call. This will tell you that you can indeed print a report using this data in a simple test.
The cachpages= true didn't fix it. I have trace thru the code and it does hit eveything a second time when i hit print from the preview screen. When the black page comes out of the printer, at least my headings and text boxes should appear if there is no data, or the no data found message should appear.
why would this only hit the detailbandbefore print on the first iteration, be it print or preview and not hit the detailbandbefore print on the second interation? It does hit the report.before print on both iterations. i still think that something somewhere got turned off that should be turned on but i can't find anything different from a report that works correctly.
It should refire. It sounds as if the event handler was disconnected. Are you loading a template? After you load the template, make sure you reconnect the event handler. Please see the Tech-Tips newsgroup in the Templates thread for an article describing how you can get in a situaiton where an event handler is 'lost'.
Can you reproduce the problem using our installed demo reports? Can you send a simple zipped Delphi project to support@digital-metaphors.com that shows the problem?
If the event handler was disconnected why does it run ok on the first time(ex: print or preview) and not the print from the preview screen? We are using templates and the templates and the event handler s work fine when the report is called to preview or print. I checked your tech notes , the situation where the event handler will get lost was never executed, meaning i never change the name of the report component.
Comments
event handlers are refiring, as they always do when generating for the
printer unless CachePages is set to true after a screen preview of the
report. Are you event handlers prepared for this? You may have to
reinitialize delphi variables that you are using before the report prints to
any device.
Disconnect your event handlers for the report until the problem goes away.
This way you'll be able to isolate what piece of the puzzle is affecting the
data or the report band visibilties if you are setting those.
Another test is to simply connect a repot to the data pipeline and create a
main report using the report wizard and print that to the printer without
any code other than a Report.Print call. This will tell you that you can
indeed print a report using this data in a simple test.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
hit eveything a second time when i hit print from the preview screen. When
the black page comes out of the printer, at least my headings and text boxes
should appear if there is no data, or the no data found message should
appear.
from the preview screen but it hit this procedure on preview.
be it print or preview and not hit the detailbandbefore print on the second
interation? It does hit the report.before print on both iterations. i
still think that something somewhere got turned off that should be turned on
but i can't find anything different from a report that works correctly.
you loading a template? After you load the template, make sure you reconnect
the event handler. Please see the Tech-Tips newsgroup in the Templates
thread for an article describing how you can get in a situaiton where an
event handler is 'lost'.
Can you reproduce the problem using our installed demo reports? Can you send
a simple zipped Delphi project to support@digital-metaphors.com that shows
the problem?
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
time(ex: print or preview) and not the print from the preview screen? We
are using templates and the templates and the event handler s work fine
when the report is called to preview or print. I checked your tech notes ,
the situation where the event handler will get lost was never executed,
meaning i never change the name of the report component.
shows the problem.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com