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 show the supported features and APIs that can be used to achieve various Word and PDF related tasks with the GemBox.Document component. GemBox.Document requires only .NET, it doesn't have any other dependency. The first step in using the GemBox.Document library is to add a reference to GemBox.Document.dll within your C# or VB.NET project. There are three ways to do that. a) Add from NuGet. You can add GemBox.Document as a package using the following command from the NuGet Package Manager Console: Or you can search and add GemBox.Document from the NuGet Package Manager. b) Add from Setup. You can download the GemBox.Document Setup from this page. After installing the setup, you can add a reference to GemBox.Document.dll from the Global Assembly Cache (GAC). c) Add from a DLL file. You can download a GemBox.Document.dll file from this page and add a reference by browsing to it. The second step is to add a directive for the GemBox.Document namespace. For a C# project, use: The third step is to set the license key to use GemBox.Document in one of its working modes. To use a Free mode in a C# project, use: You can read more about GemBox.Document's working modes on the Evaluation and Licensing help page. The last step is to write your application-specific Word code, like the following example code that shows how to create a simple document. It shows how to initialize the GemBox.Document content model, populate common document elements System Requirements
You can use it on:Hello World
Install-Package GemBox.Document
using GemBox.Document;
For a VB.NET project, use: Import GemBox.Document
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
To use a Free mode in a VB.NET project, use: ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Section
, Paragraph
and Run
, and then save a DocumentModel
instance to a Word or PDF file.using GemBox.Document;
class Program
{
static void Main()
{
// If using the 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 the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Dim document As 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