ARTICLE

Tip: How to add a Page Header to a Sub Report in Crystal Reports?

Posted by Mahesh Chand Articles | Crystal Reports C# October 09, 2006
Sub Reports in Crystal Reports do have report headers but do not support page headers. Wonder why? We can mimic the functionality with the help of a formula and a Group.
Reader Level:

Work around, work around, work around !!! This is what I do when I end up creating reports that require little bit of customization and there are times when you are tired of work arounds. Come on. Give me a break. Crystal Reports product costs so much and Business Objects folks seem to be adding patches to the old code. I would suggest them to rethink about it and rewrite the whole damn thing.

 

OK, I will stop being tetchy now. Let's get back to work.

 

Sub Reports in Crystal Reports do have report headers but do not support page headers. Wonder why? We can mimic the functionality with the help of a formula and a Group. Just follow these below steps:

 

Step 1: Create a Formula as following. I call my formula ShowPH:

 

WhileReadingRecords;

" "

 

Step 2: Add a Group from Insert Menu-select Group and you will see Insert Group. Select ShowPH formula there and click on Options tab.

 

SubRepPHImg1.gif

 

On Options tab, select "Repeat Group Header on Each Page".

 

SubRepPHImg2.gif

 

It will add a group to your sub report.

 

Step 3: Now add all text you want to display on the header of each page on the Group section area.

 

SubRepPHImg3.gif

 

Using these steps will add headers to the pages of a sub report.

Login to add your contents and source code to this article
post comment
     

our company want to change its logo in crystal report header. we have 500 reports, do you know any script for that? thanks SJ

Posted by Shyju Joseph Feb 05, 2013

Thank you Lori and other guys. Jeez .. Its been like 6 years since I touched Crystal Reports. I am finding Reports Viewer (Visual Studio) more flexible and easier to work with. No need to have too many work around for simple reports. Cheers!

Posted by Mahesh Chand Sep 01, 2012

This works great! Thank you for the work-around!

Posted by Lori Aug 31, 2012

Hi Mahesh Chand, your idea works fine when sub-report contains 0 or 1 grouping only(no charts with drill-down). But i have a scenario ... "My report contains 2 groupings, chart with 2 levels of drill-down. while drilling-down i am able to show headers for 2 levels. but i am not able show headers while navigating when my sub-report contains data of more than 1 page"any tips please ...?

Posted by Venkatanaidu Gullipalli Aug 24, 2012

Great work-around! I am finding that to be a Crystal Reports developer, you need to be a master of work-arounds.

Posted by John Jun 27, 2012
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts