public static XtraReport CreateReport() {
XtraReport report = new XtraReport() {
Name = "SimpleStaticReport",
DisplayName = "Simple Static Report",
PaperKind = PaperKind.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;
}
下面的代碼示例建立一個新的報表,設定其名稱、顯示名稱、紙張種類和頁邊距,并添加 Detail Band Band,其中包含 XRLabel 控件。
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLmVWOiNjZ4kDOlljZ3gjY4EWN1QjZycjM3Q2YiVjMjBzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)