TimeManyDocs.vb
''
'' This code is part of GrapeCity Documents for Word samples.
'' Copyright (c) GrapeCity, Inc. All rights reserved.
''
Imports System.IO
Imports System.Drawing
Imports System.Collections.Generic
Imports System.Linq
Imports GrapeCity.Documents.Word

'' This sample creates a 100 instances of GcWordDocument
'' and prints the time that it took.
Public Class TimeManyDocs
    Public Function CreateDocx() As GcWordDocument
        Const N = 100

        '' The document to show the resulting time:
        Dim doc = New GcWordDocument()
        '' Starting time:
        Dim start = DateTime.Now
        For i = 0 To N - 1
            Dim dummy = New GcWordDocument()
        Next

        '' Delta:
        Dim delta = DateTime.Now - start
        '' Print out the result:
        Dim message = $"Time used to create {n} instances of GcWordDocument: {delta}."
        doc.Body.Sections.First.GetRange().Paragraphs.Add(message)
        '' Done:
        Return doc
    End Function
End Class