Learn to Add Text Field Annotations to DOCX Files in C# .NET

If you want to highlight or add contextual notes in your Word documents through your .NET application, the GroupDocs.Annotation Cloud .NET SDK is here to help. Developers can effortlessly incorporate text field annotations into DOCX files using straightforward REST API calls. This SDK allows you to build document collaboration tools, internal review systems, or workflow automation features swiftly and effectively. With this robust .NET REST API, inserting text annotations becomes simple, enabling you to specify annotation position, size, content, author information, and more directly within your C# code. Say goodbye to manual modifications, and welcome the era of automated document collaboration. This solution is ideal for remote teams, document processors, or any application that requires real-time reviewing or editing support. Don’t let static documents hinder your workflow. Begin utilizing this Cloud API today by following this step-by-step tutorial, and empower your C#, ASP.NET, and VB.NET applications to enrich DOCX documents with text annotations, enhance interactivity, and promote better communication among teams. It’s quick, secure, and leverages the capabilities of the cloud, providing exactly what your .NET solutions need to remain competitive. The following C# code snippet allows you to easily integrate this functionality into your .NET applications: using GroupDocs.Annotation.Cloud.Sdk.Api; using GroupDocs.Annotation.Cloud.Sdk.Client; using GroupDocs.Annotation.Cloud.Sdk.Model; using GroupDocs.Annotation.Cloud.Sdk.Model.Requests; class Program { static void Main(string[] args) { // Initialize the API configuration with your credentials string MyClientId = "your-client-id"; string MyClientSecret = "your-client-secret"; var configuration = new Configuration(MyClientId, MyClientSecret); // Instantiate an AnnotateApi instance to apply the annotation var annotationApi = new AnnotateApi(configuration); // Set the input DOCX file details var fileInfo = new GroupDocs.Annotation.Cloud.Sdk.Model.FileInfo { FilePath = "SampleFiles/source.docx" }; // Create a text field annotation information block var annotation = new AnnotationInfo { AnnotationPosition = new Point { X = 1, Y = 1 }, Box = new Rectangle { X = 100, Y = 100, Width = 300, Height = 120 }, FontColor = 3329434, FontSize = 14, PageNumber = 0, Opacity = 0.8, Type = AnnotationInfo.TypeEnum.TextField, Text = "Text field annotation", CreatorName = "Cloud Annotation API", CreatedOn = DateTime.Now, }; // Set annotation options, including the output file path var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = new List { annotation }, OutputPath = "annotation/annotated-output.docx" }; // Add the text field annotation to the DOCX file var result = annotationApi.Annotate(new AnnotateRequest(options)); } }

Apr 24, 2025 - 14:00
 0
Learn to Add Text Field Annotations to DOCX Files in C# .NET

If you want to highlight or add contextual notes in your Word documents through your .NET application, the GroupDocs.Annotation Cloud .NET SDK is here to help. Developers can effortlessly incorporate text field annotations into DOCX files using straightforward REST API calls. This SDK allows you to build document collaboration tools, internal review systems, or workflow automation features swiftly and effectively.

With this robust .NET REST API, inserting text annotations becomes simple, enabling you to specify annotation position, size, content, author information, and more directly within your C# code. Say goodbye to manual modifications, and welcome the era of automated document collaboration. This solution is ideal for remote teams, document processors, or any application that requires real-time reviewing or editing support.

Don’t let static documents hinder your workflow. Begin utilizing this Cloud API today by following this step-by-step tutorial, and empower your C#, ASP.NET, and VB.NET applications to enrich DOCX documents with text annotations, enhance interactivity, and promote better communication among teams. It’s quick, secure, and leverages the capabilities of the cloud, providing exactly what your .NET solutions need to remain competitive.

The following C# code snippet allows you to easily integrate this functionality into your .NET applications:

using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;

class Program
{
    static void Main(string[] args)
    {
        // Initialize the API configuration with your credentials
        string MyClientId = "your-client-id";
        string MyClientSecret = "your-client-secret";
        var configuration = new Configuration(MyClientId, MyClientSecret);

        // Instantiate an AnnotateApi instance to apply the annotation
        var annotationApi = new AnnotateApi(configuration);

        // Set the input DOCX file details
        var fileInfo = new GroupDocs.Annotation.Cloud.Sdk.Model.FileInfo
        {
            FilePath = "SampleFiles/source.docx"
        };

        // Create a text field annotation information block
        var annotation = new AnnotationInfo
        {
            AnnotationPosition = new Point { X = 1, Y = 1 },
            Box = new Rectangle { X = 100, Y = 100, Width = 300, Height = 120 },
            FontColor = 3329434,
            FontSize = 14,
            PageNumber = 0,
            Opacity = 0.8,
            Type = AnnotationInfo.TypeEnum.TextField,
            Text = "Text field annotation",
            CreatorName = "Cloud Annotation API",
            CreatedOn = DateTime.Now,
        };

        // Set annotation options, including the output file path
        var options = new AnnotateOptions
        {
            FileInfo = fileInfo,
            Annotations = new List { annotation },
            OutputPath = "annotation/annotated-output.docx"
        };

        // Add the text field annotation to the DOCX file
        var result = annotationApi.Annotate(new AnnotateRequest(options));
    }
}