AI-powered Extensions
DevExpress Office & PDF File API includes AI-powered extensions that work with language models via the Microsoft.Extensions.AI (IChatClient) abstraction. Extensions are available for Word Processing Document API, PDF Document API, and Presentation API.
Use DevExpress AI-powered Extensions to summarize, translate, proofread, and analyze Microsoft Word documents, PDF files, and PowerPoint presentations while preserving document structure and formatting.
Supported AI Providers
AI-powered Extensions for DevExpress Office & PDF File API can be connected to a wide range of AI services and language models:
- OpenAI
- Azure OpenAI
- Ollama
- Semantic Kernel AI Connectors
- Google Gemini
- Anthropic Claude
- ONNX Runtime
- Foundry Local
- Custom AI providers via
IChatClient
Get Started
Install the AI Integration NuGet Package
dotnet add package DevExpress.AIIntegration.DocsInstall AI Runtime and Provider Packages
Refer to Prerequisites for information on required AI runtime and provider packages.
Code Example — Register a Document Processing Service
This example registers an Azure OpenAI client and configures the DevExpress document processing service.
using DevExpress.AIIntegration;
using Microsoft.Extensions.AI;
var azureOpenAIEndpoint = "<YOUR_AZURE_OPENAI_ENDPOINT>";
var azureOpenAIKey = "<YOUR_AZURE_OPENAI_API_KEY>";
var modelName = "<YOUR_MODEL_NAME>";
var builder = WebApplication.CreateBuilder(args);
// Create an Azure OpenAI client.
var azureOpenAIClient = new Azure.AI.OpenAI.AzureOpenAIClient(
new Uri(azureOpenAIEndpoint),
new System.ClientModel.ApiKeyCredential(azureOpenAIKey));
// Get a model-specific chat client and convert it to IChatClient.
IChatClient chatClient = azureOpenAIClient
.GetChatClient(modelName)
.AsIChatClient();
builder.Services.AddSingleton<IChatClient>(chatClient);
builder.Services.AddSingleton(chatClient);
// Register DevExpress AI-powered document processing services.
builder.Services.AddDevExpressAI(config => {
config.RegisterAIDocProcessingService();
});
var app = builder.Build();Code Example — Translate a Word Document
This example uses an AI service to translate Word document content into a different language.
using DevExpress.AIIntegration.Docs;
using DevExpress.XtraRichEdit;
using System.Globalization;
public class WordTranslateDemo
{
private readonly IAIDocProcessingService aiDocProcessingService;
public WordTranslateDemo(IAIDocProcessingService aiDocProcessingService)
{
this.aiDocProcessingService = aiDocProcessingService;
}
public async Task<Stream> TranslateDocument(
Stream inputStream,
string targetLanguage)
{
using var wordProcessor = new RichEditDocumentServer();
// Load the input document.
wordProcessor.LoadDocument(inputStream);
// Translate document content.
await aiDocProcessingService.TranslateAsync(
wordProcessor,
new CultureInfo(targetLanguage));
// Save the translated document.
var outputStream = new MemoryStream();
wordProcessor.SaveDocument(outputStream, DocumentFormat.Docx);
outputStream.Position = 0;
return outputStream;
}
}AI-powered Capabilities
- Chat with documents (RAG)
- hat with documents (RAG)
- Translate content and preserve formatting
- Review grammar and style
- Process Word, PDF, and PowerPoint documents
- Use cloud, local, and self-hosted AI models
- Connect to providers using Microsoft.Extensions.AI
- Bring-your-own-model (BYOM)