工具栏中找:documentViewer
public partial class DisplayReport : Form
{
XtraReport report = null;
public DisplayReport()
{
InitializeComponent();
report = new XtraReport();
InitReport();
this.WindowState = FormWindowState.Maximized;
}
private void InitReport()
{
if(File.Exists(FileSaveFilePath))
{
report.LoadLayout(FileSaveFilePath);
}
else
{
MessageBox.Show("");
return;
}
report.Landscape = false; //横向还是纵向
report.DataSource = dataset; //绑定数据源自己找datatable
this.splitContainer1.Panel2.Controls.Clear();
this.splitContainer1.Panel2.Controls.Add(documentViewer1);
documentViewer1.DocumentSource = report;
report.CreateDocument();
}
本教程介绍如何使用DevExpress库中的XtraReport组件来加载并显示报告。通过实例演示了如何初始化报告、设置报告方向及数据源,并将其显示在一个窗体上。
304

被折叠的 条评论
为什么被折叠?



