Word and PDF Library for C# and VB.NET applications

The fastest way how you can get started with GemBox.Document library is by exploring our collection of C# and VB.NET examples. These are live examples that demonstrate various supported Word features in GemBox.Document.

System Requirements

GemBox.Document works on .NET Framework 3.5 or higher and platforms that implement .NET Standard 2.0 or higher.

Hello World

The following example creates a simple Word file, with 'Hello World!' text, using C# and VB.NET code. It shows how to initialize the GemBox.Document content model, populate common document elements (Section, Paragraph and Run, and then save a DocumentModel instance to a Word or PDF file.

Word and PDF Library for C# / VB.NET Screenshot
using GemBox.Document;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = new DocumentModel();

        Section section = new Section(document);
        document.Sections.Add(section);

        Paragraph paragraph = new Paragraph(document);
        section.Blocks.Add(paragraph);

        Run run = new Run(document, "Hello World!");
        paragraph.Inlines.Add(run);

        document.Save("Hello World.%OutputFileType%");
    }
}

Imports GemBox.Document

Module Program

    Sub Main()

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

        Dim document As DocumentModel = New DocumentModel

        Dim section As New Section(document)
        document.Sections.Add(section)

        Dim paragraph As New Paragraph(document)
        section.Blocks.Add(paragraph)

        Dim run As New Run(document, "Hello World!")
        paragraph.Inlines.Add(run)

        document.Save("Hello World.%OutputFileType%")

    End Sub

End Module

Check next example or download examples from GitHub.