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

    Show / Hide Table of Contents

    ComHelper Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Contains methods that can be useful for users which are calling GemBox.Spreadsheet 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

    AddPageBreak(Object, Int32, Boolean)

    Adds a new horizontal or vertical page break above or left to the specified index.

    • C#
    • VB.NET
    public void AddPageBreak(object sheet, int index, bool horizontalBreak)
    Public Sub AddPageBreak(sheet As Object, index As Integer, horizontalBreak As Boolean)
    Parameters
    sheet
    System.Object

    The ExcelWorksheet instance in which to add a page break.

    index
    System.Int32

    The zero-based index of the row or column.

    horizontalBreak
    System.Boolean

    true for horizontal page break, false for vertical page break.

    ComSetLicense(String)

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

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

    Serial key.

    Remarks

    You should call this method before using any other class from GemBox.Spreadsheet library. Key can only be set once (if you try second 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.

    Free version serial key is: FREE-LIMITED-KEY.

    GetColumn(Object, Int32)

    Gets the column from a sheet with the specified index.

    • C#
    • VB.NET
    public ExcelColumn GetColumn(object sheet, int index)
    Public Function GetColumn(sheet As Object, index As Integer) As ExcelColumn
    Parameters
    sheet
    System.Object

    The ExcelWorksheet instance from which to retrieve the column.

    index
    System.Int32

    The zero-based index of the column.

    Returns
    ExcelColumn

    The ExcelColumn instance of the specified index.

    GetRow(Object, Int32)

    Gets the row from a sheet with the specified index.

    • C#
    • VB.NET
    public ExcelRow GetRow(object sheet, int index)
    Public Function GetRow(sheet As Object, index As Integer) As ExcelRow
    Parameters
    sheet
    System.Object

    The ExcelWorksheet instance from which to retrieve the row.

    index
    System.Int32

    The zero-based index of the row.

    Returns
    ExcelRow

    The ExcelRow instance of the specified index.

    IsEncrypted(String)

    Determines whether the file is an encrypted XLSX.

    • C#
    • VB.NET
    public bool IsEncrypted(string path)
    Public Function IsEncrypted(path As String) As Boolean
    Parameters
    path
    System.String

    The path from which to read a file.

    Returns
    System.Boolean

    true if file is an encrypted XLSX; otherwise, false.

    Load(String)

    Loads a spreadsheet from a file with the specified path.

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

    The path from which to load a spreadsheet.

    Returns
    ExcelFile

    A loaded spreadsheet.

    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 Excel: .xlsx, xlsm, .xltx, .xltm, .xls, .xlt
    • OpenDocument Spreadsheet: .ods, .ots
    • Character Separated Values: .csv, .tsv
    • HyperText Markup Language: .htm, .html, .mht, .mhtml

    LoadWithOptions(String, Object)

    Loads a spreadsheet from a file with the specified path.

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

    The path from which to load a spreadsheet.

    options
    System.Object

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

    Returns
    ExcelFile

    A loaded spreadsheet.

    RemoveColumn(Object, Int32)

    Removes the column with the specified index.

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

    The ExcelWorksheet instance from which to remove the column.

    index
    System.Int32

    The zero-based index of the column.

    RemoveRow(Object, Int32)

    Removes the row with the specified index.

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

    The ExcelWorksheet instance from which to remove the row.

    index
    System.Int32

    The zero-based index of the row.

    SaveWithOptions(Object, String, Object)

    Saves the spreadsheet to a file with the specified path.

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

    The ExcelFile instance which to save.

    path
    System.String

    The path to which to save the spreadsheet.

    options
    System.Object

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

    SetFrozenWorksheetPanes(Object, String)

    Sets frozen worksheet panes for freezing rows and columns.

    • C#
    • VB.NET
    public void SetFrozenWorksheetPanes(object sheet, string topLeftCell)
    Public Sub SetFrozenWorksheetPanes(sheet As Object, topLeftCell As String)
    Parameters
    sheet
    System.Object

    The ExcelWorksheet instance in which to freeze row and column.

    topLeftCell
    System.String

    Top left visible cell in the bottom right pane.

    Examples

    Referencing ExcelCell and CellRange in C# and VB.NET
    Convert Excel files to PDF in C# and VB.NET
    Open and read Excel file in C# and VB.NET
    Create and write Excel file in C# and VB.NET
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.