Reporting — Report Design Analyzer Enhancements (v22.1)

Reporting Team Blog
12 July 2022

As you may already know, the End-User Report Designer (for WinForms, WPF, and web platforms) that ships as part of the DevExpress Reports, integrates a built-in Report Design Analyzer  a tool that helps you and your end users detect and fix issues within a report.

Report Design Analyzer
If you are not familiar with our Report Design Analyzer, please refer to the following blog post: Reporting – Avoid Mistakes in Report Creation with The Help of Report Design Analyzer (v21.1).

We’ve received lots of great feedback since the release of the analyzer, and based on your requests/comments, we’ve introduced a few new features/capabilities in our v22.1 release cycle.

API for Configuring Analyzer Default Settings

Prior to v22.1, you and your end users could configure only a limited set of analyzer settings – via our UI. For example, you (users) could specify an error source (layout, creation, scripts), so that the analyzer displays only those messages that belong to this source. Additionally, you could enable/disable specific error message types (errors, warnings, information).

Since our default configuration did not always address application requirements (or needs to be modified prior to the first application run), we’ve introduced the ability to configure default analyzer settings in code.

Namely, in v22.1 we introduced an API (the DesignAnalyzerOptions class) to specify custom default settings for the analyzer. For example, you can now enable/disable the following analyzer elements:

  • messages that belong to a particular error source (group);
  • error codes, so that the analyzer does not show messages associated with these codes;
  • links that navigate users to detailed error code descriptions;
  • ... and more.

Some of these options can be configured via the UI and in code, while others are only available in code. The sections below offer a brief glimpse into our new API and document the analyzer’s newest capabilities.

Access Analyzer Default Settings

You can use the DesignAnalyzerOptions class to configure the analyzer within the End-User Report Designer for all supported desktop (WinForms and WPF) and web platforms. To change default settings, access the class instance in a method called at application startup and specify instance properties:

using DevExpress.XtraReports.Configuration;
//...

Settings.Default.DesignAnalyzerOptions.ShowErrors = false;

In reporting applications with ASP.NET Core backend, change the default settings as follows:

public void Configure(IApplicationBuilder app, /* ... */ ) {
    //...
    
    app.UseReporting(x => {
        x.DesignAnalyzerOptions.ShowErrors = false;
    });

    //...
}

Filter Messages by Error Source

Based on source, report errors are divided into four groups:

  • Report layout errors: These occur if report controls overlap one another or extend beyond the report’s printable area.

  • Report creation errors: These occur while the report document is created. It may involve errors related to invalid property values or unreachable sources of content.

  • Report export errors: These occur while the report document is exported to PDF, XLSX, and other file formats.

  • Report scripts errors: These are associated with script syntax errors.

Our default error source configuration will appear as follows:

Report Design Analyzer - Default error source configuration
Since report scrips are disabled in the default End-User Report Designer configuration for .NET/.NET Core projects,  script errors are not displayed. Refer to the following article for more information: Use Report Scripts.

Use the following properties to disable error messages for a specific error source:

The following code sample disables report layout and report export messages:

using DevExpress.XtraReports.Configuration;
//...  

Settings.Default.DesignAnalyzerOptions.EnableReportLayoutErrorSource = false;
Settings.Default.DesignAnalyzerOptions.EnableReportExportErrorSource = false;

If you apply these changes, the analyzer's default error source list will appear as follows:

Report Design Analyzer - Custom error source configuration

Filter Messages Associated with a Specific Error Code

Each analyzer message is associated with a unique error code. You can disable error codes, so that the analyzer does not display messages associated with each code. Let's take a look at some instances when this capability might be of value.

If your report contains overlapped controls, the End-User Report Designer highlights the controls and also displays warning messages. In other words, warning notifications come from two sources (which might introduce redundancy).

Report Design Analyzer - Overlapped controls, error notifications from two sources
To avoid this redundancy, suppress the XRE004 error code or disable highlighting for overlapped controls (set the DesignerOptions.ShowExportWarnings property to false).

Here is another use case: Assume you have expression bindings in your report but specify the data source at runtime. In this instance, error code XRE023 will appear for each control property that references a field from the data source. In this situation, it's appropriate to suppress this code.

To disable a message associated with a specific error code, add the code to the SuppressedErrorCodes collection. In the following code sample, we suppress both XRE004 and XRE023 error codes:
using System.Collections.Generic;
using DevExpress.XtraReports.Configuration;
//...

var suppressedErrorCodes = new List<string> { "XRE004", "XRE0023" };
Settings.Default.DesignAnalyzerOptions.SuppressedErrorCodes = suppressedErrorCodes;

Filter Messages by Error Type

As I already mentioned, the Report Design Analyzer displays "Error", "Warning", and "Information" message types. Using our new API, you can disable any of these message categories. The following code sample disables both "Error" and "Warning" message types.

using DevExpress.XtraReports.Configuration;
//...

Settings.Default.DesignAnalyzerOptions.ShowErrors = false;
Settings.Default.DesignAnalyzerOptions.ShowMessages = false;

The following is an image of the analyzer with disabled error and warning message types (Errors and Warnings panes are inactive):

Report Design Analyzer - Errors and Warnings messages are disabled

The properties above allow you to specify the default configuration in code - but after the End-User Report Designer is invoked you can also enable/disable specific messages types via the UI by clicking the corresponding pane.

For more information on this new capability, please review the following properties:

Navigate to Error Code Descriptions from the End-User Report Designer

You can now enable code links for error codes (so that you and your end users can click an error code and navigate to the appropriate DevExpress help topic and determine the underlying cause of the error).

The following image illustrates this feature within the DevExpress Web End-User Report Designer:

Report Design Analyzer in the Web End-User Report Designer
Set the EnableErrorCodeLinks property to true to enable error code links.

Show/Hide an Error Notification Popup in Preview

When you open a report Preview, report document generation begins, and certain errors may arise during this process. In these instances, the Report Design Analyzer displays a notification popup:

Preview - Error notification popup
If you don't want to display this popup for end users, simply set  ShowNotificationPopup to false.

New Export Error Notification Messages for End-Users

We added two new messages (XRE230 and XRE270to help you and your end users detect and fix issues related to report export operations. 

Messages associated with the XRE230 error code appear when a report layout contains overlapped controls and the document cannot be exported to Excel correctly.

Messages associated with the XRE270 error code appear if your report document contains elements that span across multiple pages and the document cannot be exported to RTF, DOCX, or Excel correctly.

Your Feedback Matters

Do you find the implemented features useful in your application and helpful for your end users? Which other customization capabilities for the Report Design Analyzer do you want to see in the future?

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.