BottomMarginBand Class

A report band used to display information at the bottom margin of every report page. This band cannot be deleted from a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.1.dll

Syntax

[BandKind(BandKind.BottomMargin)]
public class BottomMarginBand :
    MarginBand,
    IXRSerializable,
    IEnumerable,
    IBrickOwner,
    IScriptable,
    IXtraSupportDeserializeCollectionItem,
    IXtraSerializable

A default blank report contains a DetailBand, TopMarginBand and BottomMarginBand. These bands cannot be deleted.

The bottom margin band's content is printed at the bottom of a page, below all other bands.

This band is most commonly used to display auxiliary information about a report, such as page numbers or the current system date and time provided by the XRPageInfo control.

Tip

Use the TopMarginBand to display this information at the top of every report page.

See Introduction to Banded Reports for more details.

Examples

The following example demonstrates how to use the basic methods of the BandCollection class to construct a simple report. The first method (AddMarginBands) creates two margin bands, and adds them to the report's collection of bands. The second method (RemoveMarginBands) removes margin bands from the collection.

using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...

public class XtraReport1 : DevExpress.XtraReports.UI.XtraReport {
// ...

    // ...
    // Generated code for the XtraReport1 class.
    // ...

    public void AddMarginBands() {

        // Check if the TopMargin band is already present in the report.
        if(Bands.GetBandByType(typeof(TopMarginBand)) == null) {
            // Create a new TopMargin band and add it to the report.
            TopMarginBand tmBand = new TopMarginBand();
            Bands.Add(tmBand);

            // Create a label and set its text and width.
            XRLabel label = new XRLabel();
            label.Text = "TopMargin Band";
            label.Width = 200;

            // Add the label to the TopMargin band.
            tmBand.Controls.Add(label);
        }

        // Check if the BottomMargin band is already present in the report.
        if(Bands.GetBandByType(typeof(BottomMarginBand)) == null) {
            // Create a new BottomMargin band and add it to the report.
            BottomMarginBand bmBand = new BottomMarginBand();
            Bands.Add(bmBand);

            // Create an XRPageInfo object and set its width and PageInfo option.
            XRPageInfo datePageInfo = new XRPageInfo();
            datePageInfo.Width = 200;
            datePageInfo.PageInfo = PageInfo.DateTime;

            // Add the page information control to the BottomMargin band.
            bmBand.Controls.Add(datePageInfo);
        }
    }


    public void RemoveMarginBands() {
        // Obtain the TopMargin band and remove it from the report.
        Band band = Bands.GetBandByType(typeof(TopMarginBand));
        if(band != null) Bands.Remove(band);

        // Obtain the BottomMargin band and remove it from the report.
        band = Bands.GetBandByType(typeof(BottomMarginBand));
        if(band != null) Bands.Remove(band);
    }

}

And, the following code should be used to call these two methods:

XtraReport1 report = new XtraReport1();

private void btnPreview_Click(object sender, System.EventArgs e) {
    ReportPrintTool preview = new ReportPrintTool(report);
    preview.ShowPreview();
}

private void btnAddBands_Click(object sender, System.EventArgs e) {
    report.AddMarginBands();
}

private void btnRemoveBands_Click(object sender, System.EventArgs e) {
    report.RemoveMarginBands();
}

Inheritance

Object
XRControl
Band
MarginBand
BottomMarginBand

Implements

DevExpress.Utils.Serializing.Helpers.IXtraSupportDeserializeCollectionItem
DevExpress.Utils.Serializing.IXtraSerializable

Inherited Members

See Also