Back to Devexpress

XtraReport.DisplayName Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-b1f439a0.md

latest5.5 KB
Original Source

XtraReport.DisplayName Property

Gets or sets the report’s display name. If the name is not empty, it serves as the default name of the exported document and appears in the End-User Designer‘s report tab. Otherwise, the value of the report’s Name property is used as a display name.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue("")]
[SRCategory(ReportStringId.CatDesign)]
[XRLocalizable(true)]
public string DisplayName { get; set; }
vb
<DefaultValue("")>
<SRCategory(ReportStringId.CatDesign)>
<XRLocalizable(True)>
Public Property DisplayName As String

Property Value

TypeDefaultDescription
StringString.Empty

The report’s display name.

|

Remarks

The image below shows how the DisplayName property appears in the End-User Designer.

Example

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

query-builder-use-in-asp-net-core-application/CS/AspNetCoreQueryBuilderApp/Data/DbInitializer.cs#L28

csharp
var reportDescription = new ReportEntity {
    DisplayName = string.IsNullOrEmpty(reportInstance.DisplayName) ? report.Key : reportInstance.DisplayName,
    ReportLayout = SerializationService.ReportToByteArray(reportInstance),

reporting-asp-net-core-inject-data-from-efcore-dbcontext-into-report-using-object-data-source/CS/xrefcoredemo/Services/EFCoreReportStorageWebExtension.cs#L49

csharp
reportEntity.ReportLayout = ReportToByteArray(report);
reportEntity.DisplayName = report.DisplayName;
dBContext.SaveChanges();

See Also

XtraReport Class

XtraReport Members

DevExpress.XtraReports.UI Namespace