Simon Smith
04.13.2012
Hello Simon,
Thank you for your message. I believe that we have already answered a similar question in the Regarding Script in Xtrareport thread. We are looking forward to your feedback once you have had the opportunity to try recommendations from this thread.
Thanks,
Alessandro.
Hi Alessandro
The related bug report, B208912 mentioned in the link is marked as private. Can you elaborate a little, such as where the code snippet should appear. I have tried it in the xrDesignMdiController_DesignPanelLoaded event but any attempt to retrieve the ScriptControl always returns null.
Thanks
Simon
Simon,
Please accept my apologies. You can use the following code for this purpose:
[C#]private void Form1_Load(object sender, EventArgs e) { XtraReport1 report = new XtraReport1(); report.DesignerLoaded += new DevExpress.XtraReports.UserDesigner.DesignerLoadedEventHandler(report_DesignerLoaded); report.ShowDesignerDialog(); } void report_DesignerLoaded(object sender, DevExpress.XtraReports.UserDesigner.DesignerLoadedEventArgs e) { ScriptControl scriptControl = e.DesignerHost.GetService(typeof(ScriptControl)) as ScriptControl; SyntaxEditor syntaxEditor = typeof(ScriptControl).GetField("syntaxEditor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(scriptControl) as SyntaxEditor; syntaxEditor.RemoveService(typeof(ISyntaxHighlightService)); }
Attached is a complete sample that illustrates this approach in action. Hope this will help you.
Thanks,
Alessandro.
Hi Simon,
Please modify your source code as shown below to accomplish this task.
[C#]... private void Form1_Load(object sender, EventArgs e) { XtraReport1 report = new XtraReport1(); report.DesignerLoaded += new DevExpress.XtraReports.UserDesigner.DesignerLoadedEventHandler(report_DesignerLoaded); //NEW RibbonForm1 ribbonForm = new RibbonForm1(); ribbonForm.xrDesignMdiController1.OpenReport(report); ribbonForm.Show(); //report.ShowDesignerDialog(); } void report_DesignerLoaded(object sender, DevExpress.XtraReports.UserDesigner.DesignerLoadedEventArgs e) { ScriptControl scriptControl = e.DesignerHost.GetService(typeof(ScriptControl)) as ScriptControl; SyntaxEditor syntaxEditor = typeof(ScriptControl).GetField("syntaxEditor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(scriptControl) as SyntaxEditor; syntaxEditor.RemoveService(typeof(ISyntaxHighlightService)); } ...
Thanks,
Elliot
Hi Elliot
Please find attached a sample application with the attempted approach of disabling syntax highlighting.
Thanks
Simon
Hi Simon,
At present, I am unable to reproduce the problem you described. I have created and attached a screencast, illustrating my actions. Please review it and let me know whether the actions I performed are correct. It is possible that I missed something essential.
Thanks,
Elliot
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+