Summarize and Translate Reports in the Blazor Report Viewer
- 3 minutes to read
The topic describes how to integrate AI-powered Summarize and Translate commands into the Native Report Viewer for Blazor.
In Blazor Report Viewer, AI-powered capabilities are available in the Quick Actions menu and within the AI Operations tab. This tab includes two buttons designed to access the report document and process content:
- Summarize
- Uses generative AI to summarize report content and displays core insights associated with this report.
- Translate
- Uses AI services to translate report content to another language.
#Create or Open an App with DevExpress Reporting
You can open an existing application that contains a DxReportViewer component. To create a new application, refer to the following help topic: Get Started with Blazor Reporting.
#Install NuGet Packages
Install the following NuGet packages:
- DevExpress.AIIntegration.Blazor.Reporting.Viewer
- Microsoft.Extensions.AI.OpenAI, Azure.AI.OpenAI, Azure.Identity, or Microsoft.Extensions.AI.Ollama based on your AI service preferences
For the list of supported AI services and the corresponding prerequisites, refer to Supported AI Services in the following help topic: AI-powered Extensions for DevExpress Reporting.
Note
DevExpress AI-powered extensions follow the “bring your own key” principle. Dev
#Register an AI Service
Call the AddDevExpressAI method at application startup to register an AI service.
To enable the DevExpress AI-powered extension for Blazor Report Viewer, call the AddBlazorReportingAIIntegration method. Use DxBlazorReportingAIOptions to specify the following options for summarize and translate operations:
- SummarizationMode
- Specifies the summarization mode.
- Languages
- Specifies the language collection for Translate and Summarize operations.
The following code snippet registers an Azure OpenAI service and enables the AI-powered extension for the Report Viewer:
using Azure;
using Microsoft.Extensions.AI;
using DevExpress.Blazor.Reporting;
// ....
string azureOpenAIEndpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
string azureOpenAIKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
string deploymentName = "gpt4o";
//...
IChatClient asChatClient = new Azure.AI.OpenAI.AzureOpenAIClient(new Uri(AzureOpenAIEndpoint),
new System.ClientModel.ApiKeyCredential(AzureOpenAIKey))
.AsChatClient("GPT4o");
builder.Services.AddSingleton(asChatClient);
builder.Services.AddDevExpressAI(config => {
config.AddBlazorReportingAIIntegration(options => {
options.Languages = new List<LanguageItem>() {
new LanguageItem() { Key = "de", Text = "German" },
new LanguageItem() { Key = "es", Text = "Spanish" },
new LanguageItem() { Key = "en", Text = "English" }
};
options.SummarizationMode = SummarizationMode.Abstractive;
});
});
#Summarize and Translate Reports
The AI Operations tab appears in the tab panel and AI-powered context menu items are available to users:
The AI Operations tab | The AI-powered context menu actions |
---|---|
![]() |
![]() |
The AI Operations tab allows you to:
- Select input text range for Summarize and Translate operations (Document, Selected Pages, or Selected Report Content)
- Select a language for Summarize and Translate operations
- Review and copy operation output
Context menu actions allow you to summarize and translate selected report content. Operation output is displayed in the AI Operations tab.
You can now translate and summarize any report using AI-powered tools.