Printing empty reports

Stimulsoft Reports.NET discussion
Post Reply
joro
Posts: 63
Joined: Wed Jan 27, 2010 7:35 am

Printing empty reports

Post by joro »

Hello!

Some of our reports are emtpy (blank page) because the user enters criterias that yield no data.
When the user prints the report into preview then this behavior is ok because they see a blank page on the screen and realize that there is no data.
But when they send a report directly to the printer, an empty page is printed. We would like to suppress this and print no page at all.
Is there any property for the class StiReport that we could use?
We found the property 'IsRenderedReportEmpty' but it seems that it is always false.

Ho can we check if a report has loaded data from the database?
Is there any way to programmatically check this?

br
joro
Lech Kulikowski
Posts: 7345
Joined: Tue Mar 20, 2018 5:34 am

Re: Printing empty reports

Post by Lech Kulikowski »

Hello,

You can check your DataSources in the Dictionary. Something like the following:

Code: Select all

report.Load("e:\\1.mrt");
((StiSqlSource)report.Dictionary.DataSources["Categories"]).SqlCommand = "select * from Categories where 1 = 0";
var isEmpty = report.Dictionary.DataSources["Categories"].Count == 0;
Thank you.
Post Reply