Seamless integration with major language models such as OpenAI, Claude and Gemini provides extensive AI-based document processing capabilities for C#, F#, VB.NET applications.
Detect and highlight grammar errors in documents using OpenAI, Google, and Claude AI models with Aspose.Words for .NET. The CheckGrammar method analyzes DOC, DOCX, RTF, PDF, HTML, Markdown, ODT, TXT, and EPUB files and marks grammatical problems — helping you deliver polished, professional content without manual proofreading.
Authentication requires an API key from your chosen AI provider. For a full list of supported models, see the API Reference.
Start checking grammar in C# today — try the live demo above.
dotnet add package Aspose.Words
Copy
using Aspose.Words;
Document doc = new Document("Document.docx");
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Use OpenAI generative language models.
AiModel model = AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey);
CheckGrammarOptions grammarOptions = new CheckGrammarOptions();
grammarOptions.ImproveStylistics = true;
Document proofedDoc = model.CheckGrammar(doc, grammarOptions);
proofedDoc.Save("Output.docx");
using Aspose.Words;
Document doc = new Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
AiModel model = new CustomAiModel("my-model-24b", "https://your-server.com/v1").WithApiKey("");
CheckGrammarOptions grammarOptions = new CheckGrammarOptions();
grammarOptions.ImproveStylistics = true;
Document proofedDoc = model.CheckGrammar(doc, grammarOptions);
proofedDoc.Save("Output.docx");
class CustomAiModel : OpenAiModel
{
private readonly string mUrl;
internal CustomAiModel(string name, string url) : base(name) { mUrl = url; }
public override string Url => mUrl;
}
There are three alternative options to install "Aspose.Words for .NET" onto your system. Please choose one that resembles your needs and follow the step-by-step instructions:
Our product is fully cross-platform and supports all major .NET implementations:
As far as .NET code doesn't depend on the underlying hardware or operating system, but only on a Virtual Machine, you are free to develop any kind of software for Windows, macOS, Android, iOS and Linux. Just make sure you have installed the corresponding version of .NET Framework, .NET Core, Windows Azure, Mono or Xamarin.
We recommend using Microsoft Visual Studio, Xamarin, and MonoDevelop integrated development environments to create C#, F#, VB.NET applications.
Fore more details please refer to Product Documentation.