Vertical Page Header in C1Reports
C1Report is a banded report in which each Section is rendered horizontally (from left to right) one below the other. One of the most important section of the report is PageHeader that is rendered on each page of the report and run along the top of each page, horizontally. We have often come across the customers who wish to display the PageHeader on one side (mostly left) than at the top of each page. Since, C1Report is a banded report, there isn't any direct way to implement Vertical Page-Headers. In this blog, lets discuss how to implement Vertical Page Headers in C1Report. The idea here is to access the C1Document object of C1Report and then add RenderObject to this document.
Steps :
- Create a C1Report in designer and set the Height of PageHeader section to '0'.
- Design the report as per requirement and save it.
- Create a new application in VS.
Load the C1Report using the code below :
Dim rpt As New C1.C1Report.C1Report rpt.Load("..\\..\\CommonTasks.xml", "01: Alternating Background (Greenbar report)")
Use the following code to add RenderText in the C1Report.C1Document
For Each page In rpt.C1Document.Pages
Dim rendertext As New RenderText
'set the desired text here
rendertext.Text = "This is the Vertical PageHeader of the Report"
'set the desired co-ordinates here
rendertext.X = "1in"
rendertext.Y = "1in"
rpt.C1Document.Body.Children.Add(rendertext)
Next
rpt.C1Document.Generate()
For complete implementation, please refer to the attached sample. On running the sample, the output will look like the following : Please note, that this RenderObject is not included in any section of the report and can be placed at any absolute position. Download VB Sample Download CSharp Sample