Load Bold Reports® Report Server Reports

To load Bold Reports® Report Server reports in the WPF Report Viewer, set the ReportServerUrl, ReportServerCredential and ReportPath properties of the Report Viewer. The following steps explain how to render Bold Reports® Report Server reports in the WPF Report Viewer.

To quickly get started with the Report Viewer, you can watch this video:

Create a WPF .NET Core Application Using Report Viewer

  1. Open Visual Studio 2022 and click on Create new project.

  2. Select WPF Application, and then click Next.

    WPF application project template

  3. Change the project name, and then click Create.

Configure Report Viewer in an application

  1. Right-click the project or solution in the Solution Explorer tab and choose Manage NuGet Packages. Alternatively, select Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

    Refer to the NuGet Packages to learn more details about installing and configuring Report Viewer NuGet packages.

  2. Search for the BoldReports.Wpf NuGet package and install it in your WPF application.

    Package Purpose
    BoldReports.Wpf Contains WPF Reporting controls (Report Viewer and Report Writer) to preview and export the reports.

Initialize Report Viewer

  1. Import the Report Viewer namespace in the MainWindow.xaml file:

    xmlns:BoldReports="clr-namespace:BoldReports.UI.Xaml;assembly=BoldReports.Wpf"
  2. Initialize the Report Viewer component inside the <Grid> tag in the MainWindow.xaml file:

    <Window
        .....
        .....
        .....
        .....
        xmlns:BoldReports="clr-namespace:BoldReports.UI.Xaml;assembly=BoldReports.Wpf"
        .....
        .....>
        <Grid>
            <BoldReports:ReportViewer Name="reportViewer" />
        </Grid>
    </Window>

How do I render Bold Reports® Report Server reports?

To render Bold Reports® Report Server reports in the WPF Report Viewer, provide the ReportServerUrl, ReportServerCredential, and ReportPath from your report server, as follows:

  • ReportServerUrl- This API requires the Report Server URL, which contains information for the Report Server Reporting Server.
  • ReportServerCredential – This is used to set the network credentials needed to access the SQL Server Reporting Services (SSRS) server.
  • ReportPath - The report path needs to be formed with information for the category and report name, like /{category name}/{report name}.

Depending on your Report Server type, follow one of the following procedures:

Add the ReportServerExt.cs and DataClasses.cs files, which are extensions for the report server, into your WPF report viewer application to successfully display reports from the Bold Reports® Report Server.

Download the ReportServerExt.cs and DataClasses.cs report server extension files from the report server extension download.

Enterprise Reporting Server

Set the Bold Reports® Report Server report properties as shown in the following code snippet:

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    this.reportViewer.ReportServerUrl = @"https://on-premise-demo.boldreports.com/reporting/api/site/site1/";
    this.reportViewer.ReportServer = new ReportingServerExt();
    this.reportViewer.ReportServerCredential = new System.Net.NetworkCredential("[email protected]", "demo");
    this.reportViewer.ReportPath = @"/Sample Reports/Company Sales";
    this.reportViewer.RefreshReport();
}

Note: Ensure that you include the Report Server in this format: {domain}/reporting/api/site/{tenant-name}/.

Cloud Reporting Server

Set the Bold Reports® Report Server report properties as shown in the following code snippet:

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    this.reportViewer.ReportServerUrl = @"https://acmecorp.boldreports.com/reporting/api/";
    this.reportViewer.ReportServer = new ReportingServerExt();
    this.reportViewer.ReportServerCredential = new System.Net.NetworkCredential("[email protected]", "demo@123");
    this.reportViewer.ReportPath = @"/Sample Reports/Company Sales";
    this.reportViewer.RefreshReport();
}

Note: Ensure that you include the Report Server in this format: {domain}/reporting/api/.