You can use the local SSRS report (extension .rdlc). In the "Reporting" section, to create a report, there must be a new template. The report is displayed in Winforms using the Viewer Report control (the control can also be used in a WPF application using WindowsFormsHost). The only drawback is the necessary dependency that must be installed with your application. Here is a redistributable package for viewing 2010 reports.
A plus - the report can be easily placed in the SSRS instance if / when it needs to be viewed from the browser. The viewer can also display reports locally hosted on an SSRS instance.
There are many guides available on the Internet for using the report viewer, depending on the data source that will be used to populate the report. The following example uses a generic list as a data source. The labels in the new row of ReportDataSource should be the same as the name of the dataset in the report definition. The properties of the shared object must also match the column names of the dataset.
public ReportViewer(IEnumerable<UnprocessedLabel> labels) { InitializeComponent(); var reportViewer = new Microsoft.Reporting.WinForms.ReportViewer { ProcessingMode = ProcessingMode.Local }; reportViewer.LocalReport.ReportPath = System.IO.Path.GetDirectoryName(Application.ResourceAssembly.Location) + "\\UnprocessedPalletLabel.rdlc"; var ds = new ReportDataSource("labels", labels); reportViewer.LocalReport.DataSources.Add(ds); reportViewer.RefreshReport(); }
miyamotogL
source share