Back to Devexpress

PageArea.Font Property

corelibraries-devexpress-dot-xtraprinting-dot-pagearea.md

latest3.2 KB
Original Source

PageArea.Font Property

Gets or sets the font used to draw the page area’s text.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public DXFont Font { get; set; }
vb
Public Property Font As DXFont

Property Value

TypeDescription
DXFont

An object that defines the text’s format, including font face, size, and style attributes.

|

Remarks

The Font property specifies the font used to draw a page area’s text defined by the PageArea.Content property.

Example

This example demonstrates how to use the link’s PageHeaderFooter to add extra information to the document’s page header.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraPrinting;
// ...

private void button1_Click(object sender, EventArgs e) {
    string leftColumn = "Pages: [Page # of Pages #]";
    string middleColumn = "User: [User Name]";
    string rightColumn = "Date: [Date Printed]";

    // Create a PageHeaderFooter object and initializing it with
    // the link's PageHeaderFooter.
    PageHeaderFooter phf = printableComponentLink1.PageHeaderFooter as PageHeaderFooter;

    // Clear the PageHeaderFooter's contents.
    phf.Header.Content.Clear();

    // Add custom information to the link's header.
    phf.Header.Content.AddRange(new string[] { leftColumn, middleColumn, rightColumn });
    phf.Header.LineAlignment = BrickAlignment.Far;

    // Show the document's preview.
    printableComponentLink1.ShowPreview();
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting
' ...

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
Handles button1.Click
    Dim leftColumn As String = "Pages: [Page # of Pages #]"
    Dim middleColumn As String = "User: [User Name]"
    Dim rightColumn As String = "Date: [Date Printed]"

    ' Create a PageHeaderFooter object and initializing it with
    ' the link's PageHeaderFooter.
    Dim phf As PageHeaderFooter = _
        TryCast(printableComponentLink1.PageHeaderFooter, PageHeaderFooter)

    ' Clear the PageHeaderFooter's contents.
    phf.Header.Content.Clear()

    ' Add custom information to the link's header.
    phf.Header.Content.AddRange(New String() _
        {leftColumn, middleColumn, rightColumn})
    phf.Header.LineAlignment = BrickAlignment.Far

    ' Show the document's preview.
    printableComponentLink1.ShowPreview()
End Sub

See Also

PageArea Class

PageArea Members

DevExpress.XtraPrinting Namespace