Questions tagged [gembox-document]

GemBox.Document () is a .NET component that enables developers to read, write, and convert document files from their .NET applications.

GemBox.Document Free is free of charge while GemBox.Document Professional is a commercial version licensed per developer. Server deployment is royalty-free.


Support

Read Read & Write Write
DOC, DOT DOCX, DOTX, DOCM, DOTM PDF, PDF/A
PDF [β] ODT XPS
HTML, MHTML PNG, JPG, GIF, BMP, TIFF
RTF
XML
TXT

Hello World

C#

// Create a new document.
DocumentModel document = new DocumentModel();

// Create a new section.
Section section = new Section(document);
document.Sections.Add(section);

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

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

// Save as DOCX file.
document.Save("Output.docx");

VB.NET

' Create a new document.
Dim document As New DocumentModel()

' Create a new section.
Dim section As New Section(document)
document.Sections.Add(section)

' Create a new paragraph.
Dim paragraph As New Paragraph(document)
section.Blocks.Add(paragraph)

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

' Save as DOCX file.
document.Save("Hello World.docx")

Top Features


System Requirement

  • .NET Framework 3.5 - 4.8
  • .NET Core 3.1 (.NET 5 & 6 for Windows)
  • .NET Standard 2.0 (.NET 5 & 6 for Linux, macOS, Android, iOS, …)

Installation

You can download GemBox.Document from NuGet

Or from BugFixes


Resources


Related Tags

43 questions
5
votes
1 answer

Convert MSG email to PDF file in C#

I'm using GemBox.Email and GemBox.Document to convert emails to PDF. This is my code: static void Main() { MailMessage message = MailMessage.Load("input.eml"); DocumentModel document = new DocumentModel(); if…
NixonUposseen
  • 53
  • 3
  • 12
3
votes
1 answer

Compare text locations in Word document

I'm generating a Word document by replacing some placeholder text in the template document with my values. For this, I'm using GemBox.Document, more specifically, this code from Find and Replace example: var document =…
Reese Shaw
  • 33
  • 5
3
votes
2 answers

"Could not load file or assembly 'PresentationCore'" error in azure function using Gembox.Document

I currently use Gembox.Document to read content from PDF documents. I have a class library that houses it all and a self hosted .NET Core 3.1 service that references it. I query the service with the PDF data and it responds with the content. I now…
Murphybro2
  • 2,207
  • 1
  • 22
  • 36
3
votes
1 answer

Creating word file with gembox

I want to create a Word file with GemBox.Document, but I get an InvalidOperationException: Dim text As String = "Foo" + vbTab + "Bar" Dim document As New DocumentModel() document.Sections.Add( New Section(document, New…
bellpatricia
  • 39
  • 10
2
votes
1 answer

HTML to Word or PDF with GEMBOX

I am using Gembox.Documents to insert an HTML file into a Word or PDF document. Unfortunately, in the resulting Word (or pdf), the height of the contents of the rows (cells) in the table is too high and does not correspond to the original one in the…
2
votes
2 answers

When printing a pdf with Gembox.Pdf in C# the documentName in the print queue is always 'XPS Document'

I am trying to print a pdf document using Gembox.Pdf in C# (.NET Framework 4.8). This is the code I use: public void PrintPdf(string fileToPrint, string printerName, string jobName) { ComponentInfo.SetLicense("FREE-LIMITED-KEY"); …
Tijl .Reynhout
  • 901
  • 2
  • 9
  • 24
2
votes
1 answer

Updating DOCPROPERTY fields with GemBox

My document has DOCPROPERTY fields and I am trying to update them (Title, SubTitle, etc.). Dim title As String = "New Title" Dim subTitle As String = "New Sub Title" Dim document =…
bellpatricia
  • 39
  • 10
2
votes
1 answer

Edit form controls with GemBox.Document

How can we write or modify existing values of form controls in Word documents using GemBox.Document? I found the examples for creating and reading, but I just cannot find one for writing... I tried using this: // Input file from 'reading'…
Kipper
  • 21
  • 8
2
votes
1 answer

C# add event handler to class that has been loaded from an assembly at run time

As part of evaluating a 3rd party DLL called "GemBox.document", i want to be able to run this assembly during run time. However in order to get it to run in trial mode, i need to use this: ComponentInfo.FreeLimitReached += (sender, e) =>…
Notaras
  • 611
  • 1
  • 14
  • 44
1
vote
1 answer

System.InvalidOperationException when creating Word file with Gembox

We are merging a Word template document that contains merge fields using Gembox Document. We noticed when some of the field values contain special characters \t or \n, an exception occurs... An error occured - Text cannot contain new line (' '),…
John Livermore
  • 30,235
  • 44
  • 126
  • 216
1
vote
1 answer

Gembox Document HTML to PDF doesn't show the text vertically

While converting from HTML to PDF, I noticed that Gembox Document doesn't recognize the "REPRINT" strings as a vertical. The following is the HTML code: