Blue Theme Orange Theme Green Theme Red Theme
 
Discover the top 5 tips for understanding .NET Interop
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Team Foundation Server Hosting
Search :       Advanced Search »
Home » Crystal Reports C# » Tip: How to add a Page Header to a Sub Report in Crystal Reports?

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

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.

Author Rank :
Page Views : 65484
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Nevron Chart
Become a Sponsor
DevExpress Free UI Controls
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

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.

 

 

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

 

 

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.

 

 

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

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Mahesh Chand
Mahesh is the founder of C# Corner and Mindcracker Network, an author of several .NET programming books and a Microsoft MVP for 6 consecutive years. In his day to day work, Mahesh is a Senior Software Consultant with over 14 years of IT industry experience building systems for Financial and Banking, Engineering & Architectural, Imaging, Construction, Biological & Pharmaceuticals, Healthcare and Education industries. His expertise is Windows Forms, ASP.NET, Silverlight, WPF, WCF, Visual Studio 2010, SQL Server, and Oracle.  If you are looking for a Sharepoint, Windows Forms, ASP.NET, WPF, Silverlight, C#, VB.NET, Oracle, and SQL Server Consultant in Philadelphia area or remote location, drop me a line at MAHESH [AT] C-SHARPCORNER [DOT] COM.
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the top 5 tips for understanding .NET
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
Print 2 subreports contineoulsy in Crystal Report by madhusudhan On April 9, 2007
I have a subreports in a srystal report, First subreport is having a data of 5 to 6 lines, 2 nd report has to print in continuation with 1st subreport. But now i getting printing 2nd page is new Page.
Reply | Email | Modify 
Re: Print 2 subreports contineoulsy in Crystal Report by Mahesh On April 9, 2007
Not sure I understand your question.
Reply | Email | Modify 
thank you! by Osvaldo On May 20, 2007
hi from Brazil you got a great solution.. it solves my report mess... thanks a lot and keep up the great job OSVALDO
Reply | Email | Modify 
Re: thank you! by Mahesh On May 21, 2007

My pleasure OPONTES.

Feel free to share your CR tips and tricks with us ;)

Reply | Email | Modify 
Reprint Subreport header on each page by Roger On May 30, 2007

Hello, My name is Roger,

I tried your steps and or i meesed up or i dint understood something or whatever but it doesn't seems to be what i need. Im using CR 8.5.0.217 I have a report with 3 subreports each one giving some totally different information from one to the other and only the Header of the main report has common information. I need to print a subreport header in each page this subreports needs

Example
TITLE
A.- details main rep
B.- subreport_1
b.0 Title Subreport_1
b.1 detail Subreport_1
C.- subreport_2
c.0 title subreport_2
c.1 detail Subreport_2
D.- subreport_3
d.0 title Subreport_3
d.1 detail Subreport_3

The page header involves TITLE + A (details main rep)
The report detail involves the different subreports (B+C+D).
I need this b.0 (Title Subreport_1) line at the top of each page the Subreport 1 is displaying.

Do you have any idea about how to solve this? Thank you very much

Reply | Email | Modify 
Re: Reprint Subreport header on each page by Mahesh On June 3, 2007
If you click on properties of a section (right click, properties) and on one of the dialogs, there is an option called "Repeat on each page" and if you select that, that section will repeat on each page of the report. In that section, you can put your header contents.
Reply | Email | Modify 
Re: Re: Reprint Subreport header on each page by Roger On June 5, 2007
Oh! Thanks! Yes I used your "formula" to create a group inside the sub-report. Then at the grouping properties i could check the "repeat the group header on each page". It works great.
Reply | Email | Modify 
Web Services on WizCat,Libwin & PALS by Xolile On August 13, 2007
Is it possible to use web services on WizCat,Libwin and PALS Information Management System? If not what recommended technology can be used?
Reply | Email | Modify 
Web Services on WizCat,Libwin & PALS by Xolile On August 13, 2007
Is it possible to use web services on WizCat,Libwin and PALS Information Management System? If not what recommended technology can be used?
Reply | Email | Modify 
Repeating Header by Rajeev On November 25, 2007
In my report the sub-report consists of the totals (based on grouping). Now if I simply implement the workaround suggested above then the headers will be coming twice on the same page (once as the normal report page header and second as the page header of the sub-report). How can I suppress the sub-report page header if the sub-report starts in the same page as the report? I hope I'm clear with the situation. TIA.
Reply | Email | Modify 
print tile in sub apges by viji On December 5, 2007
if the first page having two more sub sections(ie, page 1(a),1(b)).then how will print the title in the sub pages?
Reply | Email | Modify 
Subreport page header with totals by Ian On March 25, 2008
Your solution to subreport page headers worked a treat. Except where the totals I'm displaying can't fit on the same page. They are printed on their own page, and the ShowPH group header isn't repeated. Any ideas on how to fix this?
Reply | Email | Modify 
Print header text by Sections by Tim On November 17, 2008
Is it possible to find out which report section is being printed and write formula to control the text to be printed in the page header for different pages? THX.
Reply | Email | Modify 
subreport footer by mona On January 5, 2009
what is the formula for subreport footer?
Reply | Email | Modify 
crystal report problem by vaquas On January 2, 2010

I have these table CustomerMaster, Sales, Product_details

I made a crystal report from these tables …like

 

CustomerCode       CustomerName     TotalSales     ProductName

11111001                    rahul                 230                  Product1

122220                        sam                  452                  product2

.

.

.

.

But I want my report look like that…..

CustomerCode       CustomerName     TotalSales     product1   product2   product3………

11111001                    rahul                 230                 

122220                        sam                  452                 

.

.

Please help me….

Reply | Email | Modify 
Thanx Buddy by Anulesh On June 10, 2010
Thanx once again this information was very useful for me

Cheers
Reply | Email | Modify 
Re: Thanx Buddy by Mahesh On June 12, 2010
You're welcome Anulesh.
Reply | Email | Modify 
What if.... by Maliqi On October 13, 2010
Hi mahesh,

What if i want to make header become like this :

Header 1

Subrep Detail 1.1
Subrep Detail 1.2

Header 2

Subrep Detail 2.1
Subrep Detail 2.2

is it possible or not? What should i do? Thanks.


Reply | Email | Modify 
Crystal report Totals in Header & Footer by Roopesh On February 16, 2011
I have a requirement to print the pagewise totals on the Page Header and Page Footer. Currently,I am able to Print Pagewise totals in PageFooter but not in PageHeader. On the second page, pageHeader is getting the value of previous page footer. First page PageHeader is printing the value as Zero.Can anyone help me in fixing this issue. Thanks in advance.
Reply | Email | Modify 
Thank you! by Mary On April 11, 2011
This helped so much!
Reply | Email | Modify 
crosstab by Reinaldo On April 18, 2011
how to do the same with crystal sub-reports using crosstab?
Reply | Email | Modify 
Creating Dummy Page footer in a sub report similar to a Page Header and make it repeat on all pages by Sankar On August 10, 2011
Hi Mahesh, Your idea to create a dummy Page Header in a sub report is highly a useful technique which works for all cases. I am looking for a similar technique to create a Dummy Page footer in a sub report and make it repeat on all pages(For eg the Page Number). I tried adding another ShwPH group and made it to 'Print at the bottom of the page' and gave the functionality to Repeat the Header on all pages',But it does not work 100%.It prints the Page Number on the header as well. I also tried placing the Page Number field on another detail section and allowed it to print at the bottom of the page,but that still did not work as expected. Kindly post your comments which will be highlly helpful for everybody. Thanks in Advance !
Reply | Email | Modify 
Insert Group option greyed out by Deon On September 1, 2011
I added the formula, and in the subreport when I try to add a group, the group option in the insert menu is greyed out. I'm using Crystal Reports in Visual Studio 2008 Pro. Any idea why? Thanks
Reply | Email | Modify 
Discover the top 5 tips for understanding .NET Interop
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.