Performance on large Word files in C# and VB.NET

You can evaluate GemBox.Document with large Word files by using it in Trial or Time Limited mode.

For Trial mode you need to handle the FreeLimitReached event, as shown in the example below.

For Time Limited mode you can contact us and request a time limited serial key.

The following example demonstrates how you can test the performance of the GemBox.Document component when processing (reading, writing, and iterating) a large Word document.

Screenshot of GemBox.Document's measured performances
GemBox.Document's performance when working with large Word document in C# and VB.NET
using System;
using System.Diagnostics;
using System.Linq;
using GemBox.Document;

class Program
{
    static void Main()
    {
        // GemBox.Document has 4 working modes, each mode has the same performance and set of features.
        // Read more on: https://www.gemboxsoftware.com/document/help/html/Evaluation_and_Licensing.htm

        // Set license key to use GemBox.Document in a Free mode.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // Continue to use the component in a Trial mode when free limit is reached.
        ComponentInfo.FreeLimitReached += (sender, e) => e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial;

        var watch = Stopwatch.StartNew();
        var document = DocumentModel.Load("%#lorem-ipsum-100-pages.docx%", LoadOptions.DocxDefault);
        Console.WriteLine($"Load file [sec]: {watch.Elapsed.TotalSeconds}");

        watch.Restart();
        int numberOfParagraphs = document.GetChildElements(true, ElementType.Paragraph).Count();
        Console.WriteLine($"Iterate through {numberOfParagraphs} paragraphs [sec]: {watch.Elapsed.TotalSeconds}");

        watch.Restart();
        document.Save("output.docx");
        Console.WriteLine($"Save file [sec]: {watch.Elapsed.TotalSeconds}");
    }
}
Imports System
Imports System.Diagnostics
Imports System.Linq
Imports GemBox.Document

Module Program

    Sub Main()

        ' GemBox.Document has 4 working modes, each mode has the same performance and set of features. 
        ' Read more on: https://www.gemboxsoftware.com/document/help/html/Evaluation_and_Licensing.htm

        ' Set license key to use GemBox.Document in a Free mode.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        ' Continue to use the component in a Trial mode when free limit is reached.
        AddHandler ComponentInfo.FreeLimitReached, Sub(sender, e) e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial

        Dim watch = Stopwatch.StartNew()
        Dim document = DocumentModel.Load("%#lorem-ipsum-100-pages.docx%", LoadOptions.DocxDefault)
        Console.WriteLine($"Load file [sec]: {watch.Elapsed.TotalSeconds}")

        watch.Restart()
        Dim numberOfParagraphs As Integer = document.GetChildElements(True, ElementType.Paragraph).Count()
        Console.WriteLine($"Iterate through {numberOfParagraphs} paragraphs [sec]: {watch.Elapsed.TotalSeconds}")

        watch.Restart()
        document.Save("output.docx")
        Console.WriteLine($"Save file [sec]: {watch.Elapsed.TotalSeconds}")

    End Sub
End Module

Download examples from GitHub.