This topic describes how to create a page header with three parts, and add a background color to the page header.
Creating a Page Header with Three Parts and Adding Background Color to the Page Header:
Here you will learn how to create a header that is divided into three columns. The following key points are shown in this topic:
The following detailed steps demonstrate how to create a header with three parts.
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1PrintDocument1.StartDoc() Dim theader As New C1.C1Preview.RenderTable(Me.C1PrintDocument1) |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1PrintDocument1.StartDoc(); C1.C1Preview.RenderTable theader = new C1.C1Preview.RenderTable(this.c1PrintDocument1); |
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
' Set up alignment for the parts of the header.
theader.Cells(0, 0).Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Left
theader.Cells(0, 1).Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center
theader.Cells(0, 2).Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Right
theader.CellStyle.Font = New Font("Arial", 14)
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
// Set up alignment for the columns of the header.
theader.Cells[0, 0].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Left;
theader.Cells[0, 1].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center;
theader.Cells[0, 2].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Right;
theader.CellStyle.Font = new Font("Arial", 14);
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
theader.Style.BackColor = Color.Gold |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
theader.Style.BackColor = Color.Gold; |
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
theader.Cells(0, 0).Text = "Left part" theader.Cells(0, 1).Text = "Center part" theader.Cells(0, 2).Text = "Right part" Me.C1PrintDocument1.RenderBlock(theader) Me.C1PrintDocument1.EndDoc() |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
theader.Cells[0, 0].Text = "Left part"; theader.Cells[0, 1].Text = "Center part"; theader.Cells[0, 2].Text = "Right part"; this.c1PrintDocument1.RenderBlock(theader); this.c1PrintDocument1.EndDoc(); |
|
Your new page header with three parts will appear similar to the header below at run time:

Your header should look similar to the following header, when you add a background color:
