Skip to main content Skip to footer

Customize Layout of Specific Page in C1Report

C1Report offers the ability to display a header on each page for a more organized view. Page headings give the report a professional look and the one reading the report has an idea of what he/she is looking at. Recently, one of our customers came up with a requirement to display page headers. However, he wanted to have a different header on each page. This sounds tricky at first but it really isn't. We can achieve this easily with the help of C1PrintDocument's PageConfigure event. This event is fired for every page and we can customize the layout of individual pages in this event.Here's how we can add a different page header on each page :

void doc_PageConfigure(C1PrintDocument sender, PageConfigureEventArgs e)  
   PageLayout layout = new PageLayout();  
   C1.C1Preview.Style style = sender.Style;  
   style.BackColor = Color.AliceBlue;  
   style.TextColor = Color.DarkRed;  
   style.FontSize = 14;  
   layout.PageHeader = new RenderText("Page Header" + e.Page.Index, style);  
   e.PageLayout = layout;  

And here's how the pages look with different page headers : C1PrintDocument_PageHeader You can do a lot more than just customize page headers in the PageConfigure event. Have fun! You may download the samples given below for complete implementation of this. Download C# Sample Download VB Sample


comments powered by Disqus