This topic demonstrates how to set up a basic End-User Report Designer on a Windows Forms application in the Professional Edition of ActiveReports.
You will add the Designer that could only edit and preview a report file.
C# code. Paste AFTER the InitializeComponent method |
Copy Code
|
---|---|
public frmMain() { InitializeComponent(); _designer.Toolbox = toolbox; } |
C# code. Paste at the top of the Form1 code view |
Copy Code
|
---|---|
using GrapeCity.ActiveReports.Design;
|
C# code. Paste INSIDE the openToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); var dialogResult = openFileDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { _designer.LoadReport(new System.IO.FileInfo(openFileDialog.FileName)); } } |
C# code. Paste INSIDE the openToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = GetSaveFilter(); var dialogResult = saveFileDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { _designer.SaveReport(new System.IO.FileInfo(saveFileDialog.FileName)); } } |
C# code. Paste AFTER the saveAsToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private string GetSaveFilter() { switch (_designer.ReportType) { case DesignerReportType.Section: return "Section Report Files (*.rpx)|*.rpx"; case DesignerReportType.Page: return "Page Report Files (*.rdlx)|*.rdlx"; case DesignerReportType.RdlMultiSection|DesignerReportType.RdlDashboard: return "RDLX Report Files (*.rdlx)|*.rdlx"; default: return "RDLX Report Files (*.rdlx)|*.rdlx"; } } |
C# code. Paste INSIDE the rdlxToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void rdlxToolStripMenuItem_Click(object sender, EventArgs e) } |
C# code. Paste INSIDE the rdlxdashboardToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void rdlxdashboardToolStripMenuItem_Click(object sender, EventArgs e) } |
C# code. Paste INSIDE the pageToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void pageToolStripMenuItem_Click(object sender, EventArgs e) { _designer.NewReport(DesignerReportType.Page); } |
C# code. Paste INSIDE the sectionToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void sectionToolStripMenuItem_Click(object sender, EventArgs e) { _designer.NewReport(DesignerReportType.Section); } |
Copy Code
|
|
---|---|
MESCIUS.ActiveReports.Export.Pdf |
C# code. Paste at the top of the Form1 code view |
Copy Code
|
---|---|
using GrapeCity.ActiveReports.Export.Pdf.Page; using GrapeCity.ActiveReports.Rendering.IO; using GrapeCity.ActiveReports; using System.IO; |
C# code. Paste AFTER the InitializeComponent method |
Copy Code
|
---|---|
public frmMain() { InitializeComponent(); _designer.Toolbox = toolbox; _designer.ActiveTabChanged += designer_ActiveTabChanged; } void designer_ActiveTabChanged(object sender, EventArgs e) { exportToolStripMenuItem.Enabled = _designer.ActiveTab == DesignerTab.Preview && _designer.ReportType != DesignerReportType.Section; } |
C# code. Paste INSIDE the exportToolStripMenuItem_Click handler |
Copy Code
|
---|---|
private void exportToolStripMenuItem_Click(object sender, EventArgs e) } |
For more information on export filters, rendering extensions and their settings, see Export Reports.
Control/Container | Name | Property Value |
---|---|---|
ReportExplorer | arReportExplorer |
ReportDesigner = _designer |
LayerList | arLayerList |
ReportDesigner = _designer |
PropertyGrid | arPropertyGrid | Resize and move as necessary. |
GroupEditor (under Containers) |
arGroupEditor |
ReportDesigner = _designer |
ReportsLibrary | arReportsLibrary |
ReportDesigner = _designer |
Press F5 to run the project. The End User Report Designer opens with an RDLX report.
For information on how you can customize the End User Report Designer and more, refer to the End User Designer sample.
You need to call the NewReport designer action in GrapeCity.ActiveReports.Design.DesignerAction.
C# code. Paste AFTER the InitializeComponent method |
Copy Code
|
---|---|
public frmMain() |
The New Report dialog shows the choice of reports to open.