TimeManyDocs.vb
  1. ''
  2. '' This code is part of Document Solutions for Word demos.
  3. '' Copyright (c) MESCIUS inc. All rights reserved.
  4. ''
  5. Imports System.IO
  6. Imports System.Drawing
  7. Imports System.Collections.Generic
  8. Imports System.Linq
  9. Imports GrapeCity.Documents.Word
  10.  
  11. '' This sample creates a 100 instances of GcWordDocument
  12. '' and prints the time that it took.
  13. Public Class TimeManyDocs
  14. Public Function CreateDocx() As GcWordDocument
  15. Const N = 100
  16.  
  17. '' The document to show the resulting time:
  18. Dim doc = New GcWordDocument()
  19. '' Starting time:
  20. Dim start = Util.TimeNow()
  21. For i = 0 To N - 1
  22. Dim dummy = New GcWordDocument()
  23. Next
  24.  
  25. '' Delta:
  26. Dim delta = Util.TimeNow() - start
  27. '' Print out the result:
  28. Dim message = $"Time used to create {n} instances of GcWordDocument: {delta}."
  29. doc.Body.Sections.First.GetRange().Paragraphs.Add(message)
  30. '' Done:
  31. Return doc
  32. End Function
  33. End Class
  34.