Examples
Working code is often the fastest way into a new topic. The samples below range from a console chat with a local model to a complete web application with the Document Editor, a document server for MCP clients and skills for AI coding assistants. Each table links the source code, and the other pages of AI Integration explain the concepts behind them.
Samples that use the TX Text Control AI preview, version 0.1.0-beta.3 at the time of writing, need a GGUF model and an inference runtime that you provide. Older blog samples call OpenAI's hosted API and need an OpenAI API key.
TX Text Control AI Samples
All ten samples are in the repository txtextcontrol-ai-samples, which Text Control AI describes how to build and run.
| Example | What it shows | Where |
|---|---|---|
| LocalChat | A minimal console loop that answers prompts with a local model and prints the model and runtime details | samples/LocalChat |
| LocalStreaming | A generated article streamed to the console as the model writes it | samples/LocalStreaming |
| LocalStructuredOutput | An invoice extracted into a typed record as JSON | samples/LocalStructuredOutput |
| LocalToolCalling | A model that calls a function of the application | samples/LocalToolCalling |
| McpChat | A console document assistant that discovers and calls the tools of the MCP document server | samples/McpChat |
| MinimalWeb | A small web page with the browser client of TXTextControl.AI.AspNetCore: progress, answers and downloads | samples/MinimalWeb |
| WebDocumentAssistant | The complete web application with Chat, Document Studio, runtime administration, knowledge collections, exports and the Document Editor | samples/WebDocumentAssistant |
| AiService | AI integration, runtime administration and knowledge hosted separately from the website behind an authenticated API | samples/AiService |
| MinimalMcpHost | The smallest host of the MCP document server, for local development | samples/MinimalMcpHost |
| McpServer | The full MCP document server with administration pages, style settings and diagnostics | samples/McpServer |
MCP Servers and Agent Skills
| Example | What it shows | Where |
|---|---|---|
| TX Text Control MCP Document Server | An ASP.NET Core server that exposes document operations built on ServerTextControl as MCP tools: sessions, creating, inspecting, editing, converting and exporting documents | TXTextControl.MCPDocumentServer |
| Document Editor skills | Agent Skills that teach AI coding assistants to integrate the Document Editor in ASP.NET Core, Angular and React and to use its JavaScript API | txtextcontrol-document-editor-skills |
| ServerTextControl skills | Agent Skills for server-side tasks such as mail merge, tables, images, headers and footers, lists, fields, subtext parts, tracked changes and PDF signing | txtextcontrol-servertextcontrol-skills |
| Text Control MCP Server | A read-only MCP endpoint with tools that give AI coding assistants access to the blog, product information and API documentation | Text Control MCP Server |
MCP Document Server describes the document server, and AI Coding Assistants the Text Control MCP Server and the skills.
Blog Samples With a Repository
| Example | What it shows | Where |
|---|---|---|
| ChatGPT in the Document Editor | Rephrasing selected text and generating formatted content with OpenAI, as described in Integrating OpenAI ChatGPT with TX Text Control to Rephrase Content and Using OpenAI to Generate Content in TX Text Control | tx-chatgpt-ai-integration |
| PDF classification | A console application that imports a PDF and lets OpenAI assign one tag from a predefined set, as described in PDF Document Classification with OpenAI and TX Text Control in C# | TXTextControl.Server.OpenAI.Classification |
| Chat PDF | Questions about a PDF, answered from the matching text chunk with OpenAI functions, as described in Chat PDF - A Generative AI Application for PDF Documents using TX Text Control and OpenAI Functions in C# | TXTextControl.OpenAI.AskPDF |
| Explaining tracked changes | The tracked changes and comments of a contract explained by OpenAI as JSON, as described in Explaining Contract Tracked Changes Automatically Using .NET C# and AI | TXTextControl.AI.TrackedChanges |
| Classification without AI | Rule-based, explainable document classification with ServerTextControl as an alternative to a model, as described in Document Classification Without AI: Deterministic, Explainable, and Built for Production in C# .NET | TXTextControl.Document.Classification |
Blog Articles With Code
| Example | What it shows | Where |
|---|---|---|
| Local LLM console chat | A streaming console chat with history and a local model, written for version 0.1.0-beta.1 of the preview | Running a Local LLM in .NET C# with TX Text Control AI |
| Document conversion without tokens | DOCX to Markdown and Markdown to PDF in code instead of with a model | Stop Burning Tokens to Convert your Documents |
| Descriptions for accessible PDF documents | Alternative texts for images, links and tables generated with OpenAI before a PDF/UA export | Automating PDF/UA Accessibility with AI: Describing DOCX Documents Using TX Text Control and LLMs |
| Legal review | Sections of a contract reviewed by a model, with the suggestions inserted as tracked changes | Transforming Legal Review with AI and TX Text Control: A Smarter, Faster Approach to Legal Document Processing in .NET C# |
| Document analysis without a model | Classification, table extraction, form field mapping and sanitization as deterministic online samples | From Classification to Data Extraction: New Document Analysis Samples |