GemBox.Document
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ComHelper Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Contains methods that can be useful for users which are calling GemBox.Document component using COM interop.

    • C#
    • VB.NET
    [ComVisible(true)]
    public class ComHelper
    <ComVisible(True)>
    Inheritance:
    System.Object
    ComHelper

    Constructors

    ComHelper()

    Initializes a new instance of the ComHelper class.

    • C#
    • VB.NET
    public ComHelper()
    Public Sub New

    Methods

    ComSetLicense(String)

    Call this method from your application to set GemBox.Document serial key.

    • C#
    • VB.NET
    public void ComSetLicense(string serialKey)
    Public Sub ComSetLicense(serialKey As String)
    Parameters
    serialKey
    System.String

    The serial key.

    Remarks

    You should call this method before using any other class from GemBox.Document assembly.

    Key can only be set once (if you try another key, exception will be thrown).

    The best place to call this method is from static constructor of your application's main class.

    Valid serial key has multiple groups of alphanumeric characters, separated with dashes.

    To use the assembly in free limited mode use FREE-LIMITED-KEY as serialKey.

    For more information about GemBox.Document evaluation and licensing, see evaluation and licensing.

    GetChildElements(Object, Boolean, Int32)

    Gets the parent's child elements filtered by ElementType.

    • C#
    • VB.NET
    public ArrayList GetChildElements(object parent, bool recursively, int filterElement)
    Public Function GetChildElements(parent As Object, recursively As Boolean, filterElement As Integer) As ArrayList
    Parameters
    parent
    System.Object

    The parent element.

    recursively
    System.Boolean

    true to get all descendants elements; otherwise false to get just child elements.

    filterElement
    System.Int32

    The ElementType to filter by.

    Returns
    System.Collections.ArrayList

    Array of child elements filtered by ElementType.

    GetElementCollectionCount(Object)

    Gets the number of elements contained in the ElementCollection.

    • C#
    • VB.NET
    public int GetElementCollectionCount(object elements)
    Public Function GetElementCollectionCount(elements As Object) As Integer
    Parameters
    elements
    System.Object

    The ElementCollection instance.

    Returns
    System.Int32

    The number of elements contained in the ElementCollection.

    GetElementCollectionItem(Object, Int32)

    Gets the Element from ElementCollection at the specified index.

    • C#
    • VB.NET
    public Element GetElementCollectionItem(object elements, int index)
    Public Function GetElementCollectionItem(elements As Object, index As Integer) As Element
    Parameters
    elements
    System.Object

    The ElementCollection instance.

    index
    System.Int32

    The zero-based index of the Element to get.

    Returns
    Element

    The Element at the specified index.

    Load(String)

    Loads a document from a file with the specified path.

    • C#
    • VB.NET
    public DocumentModel Load(string path)
    Public Function Load(path As String) As DocumentModel
    Parameters
    path
    System.String

    The path from which to load a document.

    Returns
    DocumentModel

    A loaded document.

    Remarks

    File extension that is extracted from the path is used to create the appropriate LoadOptions derived class instance that is then passed to the Load(String, LoadOptions) method.

    Following file extensions are supported:

    • Microsoft Word: .docx, .docm, .dotm, .dotx
    • Microsoft Word 97-2003: .doc, .dot
    • OpenDocument Text: .odt
    • Portable Document Format: .pdf
    • HyperText Markup Language: .htm, .html, .mht, .mhtml
    • Extensible Markup Language (Flat OPC and WordML): .xml
    • Rich Text Format: .rtf
    • Plain Text: .txt
    Exceptions
    System.InvalidOperationException

    If file extension is not specified or not supported. If file extension is not recognized, use Load(String, LoadOptions) method overload instead.

    LoadWithOptions(String, Object)

    Loads a document from a file with the specified path.

    • C#
    • VB.NET
    public DocumentModel LoadWithOptions(string path, object options)
    Public Function LoadWithOptions(path As String, options As Object) As DocumentModel
    Parameters
    path
    System.String

    The path from which to load a document.

    options
    System.Object

    The loading options which can be used to define settings for load operation.

    Returns
    DocumentModel

    A loaded document.

    RemoveElementCollectionItem(Object, Int32)

    Removes the Element at the specified index.

    • C#
    • VB.NET
    public void RemoveElementCollectionItem(object elements, int index)
    Public Sub RemoveElementCollectionItem(elements As Object, index As Integer)
    Parameters
    elements
    System.Object

    The ElementCollection instance.

    index
    System.Int32

    The zero-based index of the Element to remove.

    SaveWithOptions(Object, String, Object)

    Saves the document to a file with the specified path.

    • C#
    • VB.NET
    public void SaveWithOptions(object document, string path, object options)
    Public Sub SaveWithOptions(document As Object, path As String, options As Object)
    Parameters
    document
    System.Object

    The DocumentModel instance which to save.

    path
    System.String

    The path to which to save the document.

    options
    System.Object

    The saving options which can be used to define settings for save operation.

    Examples

    Iterating example
    Convert between Word files and HTML pages in C# and VB.NET
    Convert Word and HTML to PDF in C# and VB.NET
    Open and read Word file in C# and VB.NET
    Create and write to Word file in C# and VB.NET
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.