Skip to main content

PageArea.Content Property

Provides access to a collection of strings, representing the content of a page header or page footer.

Namespace: DevExpress.XtraPrinting

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

Declaration

public StringCollection Content { get; }

Property Value

Type Description
StringCollection

A StringCollection object, containing content strings.

Remarks

The Content collection should always contain three strings: the first to be aligned to the left page margin, the second to be displayed in the middle between the left and right margins, and the third to be aligned to the right page margin. If you don’t want to include anything in the left area or the middle area of the header or footer, simply add the empty string as the first or second element in the collection.

Below is the list of special strings which can be used to insert page information. Note that these strings can differ from those listed below if the XtraPrinting Library is localized, and uses a language other than English. In this case, the current values of the corresponding PreviewStringId members should be used.

  • “[Page #]” (represented by the DevExpress.XtraPrinting.Localization.PreviewStringId.PageInfo_PageNumber field);
  • “[Page # of Pages #]” (represented by the DevExpress.XtraPrinting.Localization.PreviewStringId.PageInfo_PageNumberOfTotal field);
  • “[Date Printed]” (represented by the DevExpress.XtraPrinting.Localization.PreviewStringId.PageInfo_PageDate field);
  • “[Time Printed]” (represented by the DevExpress.XtraPrinting.Localization.PreviewStringId.PageInfo_PageTime field);
  • “[User Name]” (represented by the DevExpress.XtraPrinting.Localization.PreviewStringId.PageInfo_PageUserName field);
  • “[Image 0]”, “[Image 1]”, … “[Image N]” (where N is the index of the image in the Link.Images collection).

Example

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

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();
}
See Also