XtraReport report = null;
PrintControl printControl = null;
PrintBarManager printBarManager = null;
string reportFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ReportFiles", "scRouteView.repx");//模板路径
public FormQueryDynamicData()
{
report = new XtraReport();
report.LoadLayout(fs);//加载模板
printControl = new DevExpress.XtraPrinting.Control.PrintControl();
printBarManager = new PrintBarManager();
printBarManager.Form = printControl;
printBarManager.Initialize(printControl);
printBarManager.MainMenu.Visible = false;
printBarManager.AllowCustomization = false;
report.RequestParameters = false;
report.DataSource = Utils.ToDataTable(new List<ViewRouteMdl>());
report.ShowPreviewMarginLines = false;
report.CreateDocument();//创建模板文档
printControl.PrintingSystem = report.PrintingSystem;
printControl.Dock = DockStyle.Fill;
printControl.Refresh();
printControl.ShowPageMargins = false;
panel1.Controls.Add(printControl);
}