我有一个devexpress报告,我想在运行时运行报表设计器,是否可能?如果可能的话请告诉我方式
答案 0 :(得分:4)
这很容易做到,我已经编写了下面的代码,这将有助于做你想做的事情
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...
private void Form1_Load(object sender, EventArgs e) {
XtraReport1 report = new XtraReport1();
ReportDesignTool dt = new ReportDesignTool(report);
// Invoke the standard End-User Designer form.
dt.ShowDesigner();
// Invoke the standard End-User Designer form modally.
dt.ShowDesignerDialog();
// Invoke the Ribbon End-User Designer form.
dt.ShowRibbonDesigner();
// Invoke the Ribbon End-User Designer form modally.
dt.ShowRibbonDesignerDialog();
}
答案 1 :(得分:1)
请注意,在最近的版本(例如14.1)中,您需要添加对 DevExpress.XtraReports.vxx.x.Extensions.dll
的引用using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
// ...
private void btnDesign_Click(object sender, EventArgs e)
{
var rpt = new Reports.XtraReport1();
var designer = new ReportDesignTool(rpt);
designer.ShowRibbonDesignerDialog();
}
答案 2 :(得分:-1)
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
private void Form1_Load(object sender, EventArgs e) {
XtraReport1 objreport= new XtraReport1();
ReportDesignTool objReportdesigner = new ReportDesignTool(objreport);
// Invoke the standard End-User Designer form.
objReportdesigner.ShowDesigner();
// Invoke the standard End-User Designer form modally.
objReportdesigner.ShowDesignerDialog();
// Invoke the Ribbon End-User Designer form.
objReportdesigner.ShowRibbonDesigner();
// Invoke the Ribbon End-User Designer form modally.
objReportdesigner.ShowRibbonDesignerDialog();
}