Martin Praxmarer - DevExpress MVP
06.23.2012
1 Solution
Hi Martin,
Thank you for your message.
You can create your own report templates without using the ReportTemplateExtension class. Here is some sample code.
[C#]... public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { XRDesignForm f = new XRDesignForm(); f.DesignMdiController.DesignPanelLoaded += new DesignerLoadedEventHandler(DesignMdiController_DesignPanelLoaded); f.ShowDialog(); } void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs e) { XtraReport rootReport = e.DesignerHost.RootComponent as XtraReport; ComponentDesigner designer = e.DesignerHost.GetDesigner(rootReport) as ComponentDesigner; designer.Verbs.Add(new CustomDesignerVerb(rootReport, "Load Report Template...", OnLoadReportTemplate)); } void OnLoadReportTemplate(object sender, EventArgs e) { System.Windows.Forms.MessageBox.Show("Show here your custom template form"); using(Report1 reportTemplate = new Report1()) { using(MemoryStream stream = new MemoryStream()) { reportTemplate.SaveLayoutToXml(stream); stream.Position = 0; //native XtraReports method new DevExpress.XtraReports.Import.TemplatesConverter().Convert(stream, ((CustomDesignerVerb)sender).Report); } } } } class CustomDesignerVerb : DesignerVerb { public XtraReport Report { get; private set; } public CustomDesignerVerb(XtraReport report, string text, EventHandler handler) : base(text, handler) { Report = report; } } ...
Thanks,
Elliot
-
Ok thx Elliot - i was at least hoping to reuse some infrastructure - not to build everything from scratch...
thx
-
Please notify us about your progress.
-
Thank you Elliot - finally implemented all neccecary parts - and it works like a charm! Thank you for your help!
-
Thank you for your feedback.
I am glad to hear that the issue has been resolved. Please contact us if you experience any further difficulties.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+