Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V26.2
  • Optimize Report Design Using AI in the WinForms Report Designer

    • 5 minutes to read

    This help topic describes how to configure the WinForms Report Designer to allow AI-assisted report design optimization. The AI Assistant can analyze report elements and their property values and suggest changes that clean up report structure and formatting.

    The AI Assistant does not change report content, data bindings, or layout. The assistant displays all proposed changes for review and updates the report only after the user selects the changes to apply.

    To fix issues detected by the Report Design Analyzer, use another AI-powered extension: Fix Report Design Issues with AI in the WinForms Report Designer.

    Install NuGet Packages

    Install the following NuGet packages:

    See the following help topic for information on how to install DevExpress NuGet packages: Install DevExpress Products.

    Note

    DevExpress AI-powered extensions follow the “bring your own key” principle. DevExpress does not offer a REST API and does not ship any built-in LLMs/SLMs. You need an active Azure/Open AI subscription to obtain the REST API endpoint, key, and model deployment name. These variables must be specified at application startup to register AI clients and enable DevExpress AI-powered Extensions in your application.

    Register Your AI Client

    The following code snippet registers an Azure OpenAI client at application startup:

    using Azure.AI.OpenAI;
    using DevExpress.AIIntegration;
    using Microsoft.Extensions.AI;
    using System.ClientModel;
    
    internal static class Program {
        static string AzureOpenAIEndpoint { get { return "AZURE_OPENAI_ENDPOINT"; } }
        static string AzureOpenAIKey { get { return "AZURE_OPENAI_APIKEY"; } }
        static string DeploymentName { get { return "MODEL_NAME"; } } // For example, gpt-5.2.
        [STAThread]
        static void Main(){
            IChatClient client = new AzureOpenAIClient(
                new Uri(AzureOpenAIEndpoint),
                new ApiKeyCredential(AzureOpenAIKey))
                    .GetChatClient(DeploymentName).AsIChatClient(); 
            AIExtensionsContainerDesktop.Default.RegisterChatClient(client);
            ApplicationConfiguration.Initialize();
            Application.Run(new Form1());
        }
    }
    

    Create and Configure an AI Assistant Behavior

    1. Drop the BehaviorManager component from the Toolbox onto a Form that contains the WinForms Report Designer.
    2. Open the BehaviorManager smart tag menu and click Edit Behaviors to open the Behavior Collection Editor.

      Note

      In .NET Framework projects, click Register AI-powered Behaviors in the BehaviorManager smart tag menu to add DevExpress AI-powered behaviors to the BehaviorManager.

    3. Add a Report Design Optimizer Behavior.

    Create and Configure an AI Assistant Behavior in Code

    Attach the ReportDesignOptimizerBehavior to the Report Designer.

    using DevExpress.AIIntegration.WinForms.Reporting;
    // ...
        public partial class Form1 : Form{
            public Form1(){
                InitializeComponent();
                behaviorManager1.Attach<ReportDesignOptimizerBehavior>(reportDesigner1, behavior => {   
                });
            }
        }
    

    Available Optimizations

    The AI Assistant can optimize a report in the following ways:

    Convert adjacent controls to tables
    Converts three or more labels located in the same band into a single table. If label vertical positions (Y coordinates) differ, the AI Assistant aligns the labels before the conversion. Tables maintain a consistent report layout and improve XLS/XLSX/CSV export quality, compared to loosely positioned labels.
    Use type-based text alignment in table columns
    Corrects text alignment in labels and table cells bound to data fields. The AI Assistant determines alignment based on the field’s data type and name. For example, the assistant aligns numeric values to the right. Elements that already have correct alignment remain unchanged.
    Clean up report control formatting
    Finds two or more controls with identical appearance settings, creates a single report style from these settings, and assigns the style to the controls. Controls with distinct appearance settings remain unchanged. This optimization reduces report definition size and makes the report easier to maintain.

    Optimize a Report

    Click the report’s smart tag and expand the AI Assistant section. Use one of the following commands:

    Optimize with AI
    Runs all available optimizations.
    Convert adjacent controls to tables, Use type-based text alignment in table columns, Clean up report control formatting
    Runs the corresponding optimization only.

    AI Assistant section in smart tag

    While the LLM analyzes the report, the AI Assistant displays a wait screen. You can click Cancel to stop the analysis.

    When the analysis is complete, the Review Changes dialog appears. The AI Assistant does not modify the report until you select changes in this dialog.

    Review Changes dialog

    The dialog groups changes by optimization type. Group names match the AI Assistant commands in the smart tag. Each change lists the affected report element, the change description, relevant property values (old and new), and a label that indicates the change type (Modify, Add, or Remove). Use checkboxes to select all or individual changes.

    Some changes depend on each other, and the AI Assistant applies them together:

    • A label-to-table conversion is a single change that removes the labels and adds the table. You cannot apply only a part of this change.
    • If a data alignment correction relies on a style that another change creates, the alignment change requires the style change. When you clear the style change, the dialog automatically clears the dependent alignment change. This behavior prevents a control from referencing a style that does not exist.

    Use Search to filter changes by text.

    Click Apply to update the report with the selected changes. Click Cancel to close the dialog without applying any changes.