Back to Devexpress

Create a Simple Static Report

xtrareports-403670-feature-guide-to-devexpress-reports-reporting-api-create-reports-in-code-create-a-simple-static-report.md

latest2.0 KB
Original Source

Create a Simple Static Report

  • Feb 18, 2026

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.

csharp
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;
}
vb
Imports System.Drawing
Imports System.Drawing.Printing
Imports DevExpress.Drawing
Imports DevExpress.Drawing.Printing
Imports DevExpress.XtraReports.UI
' ...
Public Shared Function CreateReport() As XtraReport
    Dim report As New XtraReport() With {
        .Name = "SimpleStaticReport",
        .DisplayName = "Simple Static Report",
        .PaperKind = DXPaperKind.Letter,
        .Margins = New DXMargins(100, 100, 100, 100)}

    Dim detailBand As New DetailBand() With {
        .HeightF = 25}
    report.Bands.Add(detailBand)

    Dim helloWordLabel As New XRLabel() With {
        .Text = "Hello, World!",
        .Font = New DXFont("Tahoma", 20.0F, DXFontStyle.Bold),
        .BoundsF = New RectangleF(0, 0, 250, 50)}
    detailBand.Controls.Add(helloWordLabel)

    Return report
End Function