I have a report where the report footer bleeds over to the last (empty page) forcing the PageHeader to print on the last empty (except for the report footer) page.
I've tried the following without success:
void PageFooter_BeforePrint(object sender, EventArgs e) {
object row = this.GetCurrentRow();
if (row == null)
e.Cancel = true;
}
This does not work since row is never null.
I've tried setting PageHeader.PrintOn to NotWithReportFooter - this does not work also because it separates the PageHeader from ReportFooter always - not what I want.
I did the following, which does work:
private int rowCounter = 0;
Detail.AfterPrint += (o, args) => { rowCounter++; };
PageHeader.BeforePrint += (o, args) =>
{
if (rowCounter >= this.RowCount)
args.Cancel = true;
};
but it's a hack and real ugly.
Please tell me there is a better way to handle this.
How to hide the page header if there are no detail records on that page?
Answers approved by DevExpress Support
Hello Robert.
Thank you for your message. I am afraid there is no other way to find out whether the last page contains detail data. Thus, your approach is correct, and I see no problems with using it.
Please feel free to contact us if you have any questions regarding our controls. We will do our best to find a solution for you.
Best regards,
Ingvar.
Using this method, I've found that if just one detail row falls onto the last page the page header will not be displayed. Do we have a better solution for this issue yet?
Hello Nathan,
Would you please create a new ticket and provide us with a small sample illustrating your issue in action? We will examine it and do our best to help you.
I need this. Where did you put the code that works? In PageFooter_BeforePrint?
Hello,
To process your inquiry in the most efficient manner, I've created a separate ticket on your behalf (T631067: How to hide the page footer if there are no detail records on a page). It has been placed in our processing queue and will be answered shortly.