Skip to main content

PageTableBrick Class

A visual brick comprised of rows and columns.

Namespace: DevExpress.XtraPrinting

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

NuGet Package: DevExpress.Printing.Core

Declaration

public class PageTableBrick :
    PanelBrick,
    IPageBrick

Remarks

PageTableBrick is comprised of rows, with each row containing any number of other bricks. The main purpose of PageTableBrick is to provide a fixed structure to assorted bricks.

PageTableBrick

Note

You can utilize PageTableBrick only in the top and/or bottom margin areas of a document.

Example

This example illustrates the use of PageTableBrick. First we create an array of PageInfoBricks, intended to display the current date, page number and company name. Then we create a new PageTableBrick object and populate it with bricks from the array. And finally, we draw the PageTableBrick in the BrickModifier.MarginalHeader page area and preview the report.

The result is shown in the following picture:

PageTableBrick

using DevExpress.XtraPrinting;
// ...

    BrickGraphics brickGraph = printingSystem1.Graph;

    // Fill an array with bricks.
    Brick[] bricks = new Brick[] { CreateBrick("A Summary of {0:MMMM yyyy}", 
        PageInfo.DateTime), CreateBrick("Page number is {0} of the total {1} page(s)",
        PageInfo.NumberOfTotal), CreateBrick("Developer Express Inc.", 
        PageInfo.None)};

    // Create a PageTableBrick object filled with bricks.
    PageTableBrick table = CreateTable(bricks);
    table.Alignment = BrickAlignment.Near;

    // Start the report generation.
    printingSystem1.Begin();

    // Specify the page area.
    brickGraph.Modifier = BrickModifier.MarginalHeader;

    // Draw a table.
    brickGraph.DrawBrick(table);

    // Finish the report generation.
    printingSystem1.End();

    // Preview the report.
    printingSystem1.PreviewFormEx.Show();

// Creates a PageTableBrick object and places the bricks into table cells.
private PageTableBrick CreateTable(Brick[] bricks) {
    PageTableBrick table = new PageTableBrick();
    foreach(Brick brick in bricks) {
        TableRow row = table.Rows.AddRow();
        row.Bricks.Add(brick);
    }

    // It is necessary to recalculate the size of a PageTableBrick.
    table.UpdateSize();
    return table;
}

// Creates a PageInfoBrick to display information.
private Brick CreateBrick(string format, PageInfo info) {
    PageInfoBrick infoBrick = new PageInfoBrick();
    infoBrick.Format = format;
    infoBrick.PageInfo = info;
    infoBrick.Sides = BorderSide.None;
    infoBrick.Rect = new RectangleF(0, 0, 0, 18);
    infoBrick.AutoWidth = true;
    return infoBrick;
}

Inheritance

Object
DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase
See Also