工具栏中找: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();
}