Skip to main content
All docs
V23.2

Create a Simple Static Report

The code sample below creates a new report, sets its name, display name, paper kind and margins, and adds the Detail Band band with the XRLabel control on it.

result-static-report-runtime

using System.Drawing;
using DevExpress.Drawing;
using DevExpress.Drawing.Printing;
using DevExpress.XtraReports.UI;
// ...
public static XtraReport CreateReport() {
    XtraReport report = new XtraReport() {
        Name = "SimpleStaticReport",
        DisplayName = "Simple Static Report",
        PaperKind = DXPaperKind.Letter,
        Margins = new DXMargins(100, 100, 100, 100)
    };

    DetailBand detailBand = new DetailBand() {
        HeightF = 25
    };
    report.Bands.Add(detailBand);

    XRLabel helloWordLabel = new XRLabel() {
        Text = "Hello, World!",
        Font = new DXFont("Tahoma", 20f, DXFontStyle.Bold),
        BoundsF = new RectangleF(0, 0, 250, 50),
    };
    detailBand.Controls.Add(helloWordLabel);

    return report;
}