Skip to main content
All docs
V25.1
  • BrickSelector.GetBricksByTag(Page, Object) Method

    A static method that returns an enumeration of visual bricks with the specified tag from a document page.

    Namespace: DevExpress.XtraPrinting

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

    NuGet Package: DevExpress.Printing.Core

    Declaration

    public static IEnumerable<VisualBrick> GetBricksByTag(
        Page page,
        object tag
    )

    Parameters

    Name Type Description
    page Page

    The page from which to return bricks.

    tag Object

    The tag value. A brick is returned if its tag value matches the specified value.

    Returns

    Type Description
    IEnumerable<VisualBrick>

    Bricks from the specified page.

    Remarks

    BrickSelector methods can be used to post-process a generated document. The basic idea is to first use the Tag property to tag controls on the report page, and then use the GetBricksByTag method to find bricks generated by tagged controls on the report page and adjust their size and position.

    For more information on document bricks, review the following help topic: Bricks.

    Example - Hide the Last Line on a Page

    The following code snippet hides the horizontal line that appears at the bottom of each page. The report contains the XRLine control in the DetailBand, with the Tag property set to “line”. This control will be rendered on more than one brick in the document. The last such brick on a page is hidden.

    using DevExpress.XtraPrinting;
    using DevExpress.XtraReports.UI;
    using System.Collections.Generic;
    // ...
    var report = new XtrReport1();
    report.CreateDocument();
    foreach (Page currentPage in report.PrintingSystem.Document.Pages) {
        List<Brick> bricks = BrickSelector.GetBricksByTag(currentPage, "line").ToList<Brick>();
        bricks[bricks.Count - 1].IsVisible = false;
    }
    ReportPrintTool reportTool = new ReportPrintTool(report)
    reportTool.ShowRibbonPreviewDialog();  
    
    See Also