Intellisense is included in the object and full documentation is available in the Downloads section.

Usage Example

Code block:
' Create invisible Excel.Application object.
Using xl As New ExcelDriver.Excel

    ' Add a workbook.
    ' This workbook will not have any sheets.
    Dim xlWorkbook As ExcelDriver.Workbook = xl.AddWorkbook

    ' Add some sheets to the workbook.
    Dim xlWorksheet1 As ExcelDriver.Worksheet = xlWorkbook.AddWorksheet("My Sheet")
    Dim xlWorksheet2 As ExcelDriver.Worksheet =
        xlWorkbook.AddWorksheet("Another Sheet", after:=xlWorksheet1)
    Dim xlWorksheet3 As ExcelDriver.Worksheet =
        xlWorkbook.AddWorksheet("Before Others", before:=xlWorksheet1)

    ' Show the Excel object.
    xl.Visible = True

    With xlWorksheet1
        ' Bring the sheet to the front.
        .SetActive()

        ' Set values.
        .SetValue(1, 1, 5) ' Row 1, Column 1, Value = 5
        .SetValue(1, "B", 10) ' Row 1, Column B, Value = 10

        ' Manually enter formula instead of using the formula builder.
        .SetFormula("C1", "=RC[-2]+RC[-1]") ' Cell C1, Formula = A1+B1


        Dim xlRange As ExcelDriver.Range = .GetRange("A3:C5")

        ' Set Cells A3 - C5 to the Excel formula to generate a random number.
        xlRange.Formula = "=RAND()"

        ' Place a border around the top and right sides.
        xlRange.SetBorder(style:=ExcelDriver.Constants.BorderStyle.Single,
                            weight:=ExcelDriver.Constants.BorderWeight.Normal,
                            color:=RGB(0, 0, 0), modifyTop:=True, modifyRight:=True)

        ' Set the background color to blue.
        xlRange.SetProperties(backColor:=RGB(0, 0, 255))


        ' Build an Excel formula reference (R1C1 format) for A3 - C5
        ' with respect to the destination Cell, D5.
        Dim formulaString As String =
            String.Format("=AVERAGE({0}:{1})",
                            ExcelDriver.Util.GetFormulaReference(5, "D", 3, "A"),
                            ExcelDriver.Util.GetFormulaReference(5, 4, 5, 3))

        ' Row 4, Column 4 (Cell D5), Formula =AVERAGE(R[-2]C[-3]:RC[-1])
        .SetFormula(5, 4, formulaString)

        ' Write the generated formula to D6.
        .SetValue("D6", "'" & formulaString)


        ' Set the first row to bold, italics, and red.
        .GetRange("1:1").SetFont(bold:=True, italic:=True, color:=RGB(255, 0, 0))

        ' Set Column D to be 3x the width.
        ' Can use either D or 4 to reference the column.
        .SetColumnWidth("D", .GetColumnWidth(4) * 3)

        ' Center the text of column D.
        .GetRange("D:D").SetProperties(
            horizontalAlign:=ExcelDriver.Constants.HorizontalAlignment.Center)

    End With

    ' Hide Excel.
    xl.Visible = False

    ' Save.
    xlWorkbook.Save("Test File.xlsx")

    ' End Using will release all Excel resources and display the hidden application.
End Using

Last edited Feb 6, 2014 at 6:02 PM by faulkner132, version 2