TimeManyDocs.vb
C# VB
'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.Collections.GenericImports System.LinqImports 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 = Util.TimeNow() For i = 0 To N - 1 Dim dummy = New GcWordDocument() Next
'' Delta: Dim delta = Util.TimeNow() - 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 FunctionEnd Class