public EndUserDesignerForm(string reportName, string reportTemplatePath) { System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(reportTemplatePath)); InitializeComponent(); // Create new report instance and assign to Report Explorer this.arDesigner.Toolbox = this.arToolbox; this.arDesigner.PropertyGrid = this.arPropertyGrid; // Add Menu and CommandBar to Form this.commandBarManager = this.arDesigner.CommandBarManager; // Edit CommandBar // NOTE: need check after each used version of ActiveReports - can be changed this.commandBarManager.CommandBars.RemoveAt(0); // NOTE: remove menu CommandBarItem item = this.commandBarManager.CommandBars[0].Items[2]; // NOTE: get SaveAs button this.commandBarManager.CommandBars[0].Items.Clear(); // NOTE: remove New, Open, SaveAs buttons this.commandBarManager.CommandBars[0].Items.AddButton(item.Image, item.Text, new CommandEventHandler(OnSaveNew), 0); // NOTE: set customize Save routine this.Controls.Add(this.commandBarManager); // Fill Toolbox LoadTools(this.arToolbox); // Activate default group on the toolbox this.arToolbox.SelectedCategory = "ActiveReports 3.0"; // Setup Status Bar this.arStatus.Panels.Add(new StatusBarPanel()); this.arStatus.Panels.Add(new StatusBarPanel()); this.arStatus.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring; this.arStatus.Panels[1].AutoSize = StatusBarPanelAutoSize.Spring; this.arStatus.ShowPanels = true; ActiveReport3 rpt = new ActiveReport3(); rpt.LoadLayout(reportTemplatePath); arDesigner.Report = rpt; if (!string.IsNullOrEmpty(reportName)) { this.Text = reportName; } templatePath = reportTemplatePath; }
/// <summary> /// Loads report structure. /// </summary> /// <param name="templatePath">Report template path.</param> /// <returns>Created and inited report core.</returns> private ActiveReport3 _LoadReportStructure(string templatePath) { Debug.Assert(!string.IsNullOrEmpty(templatePath)); // load report structure var rpt = new ActiveReport3(); rpt.Document.CacheToDisk = true; rpt.Document.CacheToDiskLocation = GetTempFullFileName(); string filePath = ReportsGenerator.GetTemplateAbsolutelyPath(templatePath); using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) rpt.LoadLayout(fs); return(rpt); }
/// <summary> /// Loads report structure. /// </summary> /// <param name="templatePath">Report template path.</param> /// <returns>Created and inited report core.</returns> private ActiveReport3 _LoadReportStructure(string templatePath) { Debug.Assert(!string.IsNullOrEmpty(templatePath)); // load report structure var rpt = new ActiveReport3(); rpt.Document.CacheToDisk = true; rpt.Document.CacheToDiskLocation = GetTempFullFileName(); string filePath = ReportsGenerator.GetTemplateAbsolutelyPath(templatePath); using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) rpt.LoadLayout(fs); return rpt; }
public EndUserDesignerForm(string reportName, string reportTemplatePath) { System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(reportTemplatePath)); InitializeComponent(); // Create new report instance and assign to Report Explorer this.arDesigner.Toolbox = this.arToolbox; this.arDesigner.PropertyGrid = this.arPropertyGrid; // Add Menu and CommandBar to Form this.commandBarManager = this.arDesigner.CommandBarManager; // Edit CommandBar // NOTE: need check after each used version of ActiveReports - can be changed this.commandBarManager.CommandBars.RemoveAt(0); // NOTE: remove menu CommandBarItem item = this.commandBarManager.CommandBars[0].Items[2]; // NOTE: get SaveAs button this.commandBarManager.CommandBars[0].Items.Clear(); // NOTE: remove New, Open, SaveAs buttons this.commandBarManager.CommandBars[0].Items.AddButton(item.Image, item.Text, new CommandEventHandler(OnSaveNew), 0); // NOTE: set customize Save routine this.Controls.Add(this.commandBarManager); // Fill Toolbox LoadTools(this.arToolbox); // Activate default group on the toolbox this.arToolbox.SelectedCategory = "ActiveReports 3.0"; // Setup Status Bar this.arStatus.Panels.Add(new StatusBarPanel()); this.arStatus.Panels.Add(new StatusBarPanel()); this.arStatus.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring; this.arStatus.Panels[1].AutoSize = StatusBarPanelAutoSize.Spring; this.arStatus.ShowPanels = true; ActiveReport3 rpt = new ActiveReport3(); rpt.LoadLayout(reportTemplatePath); arDesigner.Report = rpt; if (!string.IsNullOrEmpty(reportName)) this.Text = reportName; templatePath = reportTemplatePath; }