Explain Formula
- 2 minutes to read
AI-powered “Explain Formula” extension generates a detailed explanation of the formula used in a worksheet cell (clarifying its purpose and function).
Applies To
How It Works
The DevExpress WinForms Spreadsheet control seamlessly integrates the “Explain Formula” extension. When “Explain Formula” is activated, the AI Assistant | Explain Formula command is automatically added to a worksheet cell’s popup menu.
Activate Explain Formula
1. Install DevExpress NuGet Packages
DevExpress.AIIntegration.WinForms
DevExpress.Win.Design
(enables design-time features for DevExpress UI controls)
Read the following help topics for information on how to obtain the DevExpress NuGet Feed and install DevExpress NuGet packages:
- Choose Between Offline and Online DevExpress NuGet Feeds
- Install NuGet Packages in Visual Studio, VS Code, and Rider
2. Register AI Client
The following code snippet registers the Azure OpenAI client:
using Microsoft.Extensions.AI;
using DevExpress.AIIntegration;
internal static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
IChatClient asChatClient = new Azure.AI.OpenAI.AzureOpenAIClient(new Uri(AzureOpenAIEndpoint),
new System.ClientModel.ApiKeyCredential(AzureOpenAIKey))
.AsChatClient("GPT4o");
AIExtensionsContainerDesktop.Default.RegisterChatClient(asChatClient);
Application.Run(new Form1());
}
static string AzureOpenAIEndpoint { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"); } }
static string AzureOpenAIKey { get { return Environment.GetEnvironmentVariable("AZURE_OPENAI_APIKEY"); } }
}
Tip
Read the following help topic for additional information: How to Register an AI Client.
3. Create and Configure Explain Formula Behavior
- Drop the
BehaviorManager
component from the Toolbox onto a Form. Add a ExplainFormulaBehavior, configure its settings, and attach the behavior to a DevExpress WinForms Spreadsheet control. You can do this at design time or in code: