GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API.

Text Boxes

Text Boxes give you control over the position of a block of text in your document.

Following example shows how GemBox.Document reads Text Boxes and their properties (fill, outline, etc.) from DOCX and how to add new Text Box to the document with GemBox.Document API.

For more information about Text Boxes, see Shapes and Layout help page.

Screenshot
Text Boxes Screenshot

See the full code below, use Run Example to execute.

Upload your file(Drag files here)

Download a sample file

using System;
using System.IO;
using System.Linq;
using GemBox.Document;
using GemBox.Document.Drawing;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = DocumentModel.Load("TextBoxes.docx");

        var textBox = new TextBox(document,
            Layout.Floating(
                new HorizontalPosition(HorizontalPositionType.Right, HorizontalPositionAnchor.Margin),
                new VerticalPosition(VerticalPositionType.Bottom, VerticalPositionAnchor.Margin),
                new Size(4, 3.5, LengthUnit.Centimeter)),
            new Paragraph(document, "Text Box created with GemBox.Document."),
            new Paragraph(document, "It has default fill and outline."));

        document.Sections[0].Blocks.Cast<Paragraph>(0).Inlines.Add(textBox);

        document.Save("Text Boxes.docx");
    }
}
Imports System
Imports System.IO
Imports System.Linq
Imports GemBox.Document
Imports GemBox.Document.Drawing

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document As DocumentModel = DocumentModel.Load("TextBoxes.docx")

        Dim textBox = New TextBox(document,
            Layout.Floating(
                New HorizontalPosition(HorizontalPositionType.Right, HorizontalPositionAnchor.Margin),
                New VerticalPosition(VerticalPositionType.Bottom, VerticalPositionAnchor.Margin),
                New Size(4, 3.5, LengthUnit.Centimeter)),
            New Paragraph(document, "Text Box created with GemBox.Document."),
            New Paragraph(document, "It has default fill and outline."))

        document.Sections(0).Blocks.Cast(Of Paragraph)(0).Inlines.Add(textBox)

        document.Save("Text Boxes.docx")

    End Sub

End Module

Check next sample.