How to use ReoGrid in VB.NET

ReoGrid is fully available in VB.NET since it is developed by C#.NET, both languages are .NET Framework based.

Make spreadsheet template by Excel

From the version 0.8.8, ReoGrid supports that load and save Excel(xlsx) file. It’s possible to make any spreadsheet templates by Excel, and show them in any .NET application with ReoGrid 0.8.8. See Excel file format support.

Make spreadsheet template by ReoGridEditor

See how to create a template to show spreadsheet on windows form.

Put ReoGrid on Windows Form

To put ReoGrid on a windows from in VB.NET use the code like this:

Dim grid As New unvell.ReoGrid.ReoGridControl
grid.Dock = DockStyle.Fill
Me.Controls.Add(grid)

'Get default worksheet instance
Dim sheet = grid.CurrentWorksheet
'Set cell value
sheet("A1") = "A"

Load template spreadsheet

Load Excel format template from stream:

'Load from file
grid.Load("C:\mypath\template.xlsx");

'Load from stream
Using s As New System.IO.FileStream("C:\mypath\template.xlsx", _
    IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
  grid.Load(s, IO.FileFormat.Excel2007)
End Using

Load ReoGrid format template from stream:

'Load from file
sheet.Load("C:\mypath\template.rgf")

'Load from stream
Using s As New System.IO.FileStream("C:\mypath\template.rgf", _
    IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
  sheet.Load(s, IO.FileFormat.ReoGridFormat)
End Using

Form shows spreadsheet like this:

175

Hide sheet tab control and scroll bars

ReoGrid has WorkbookSettings and WorksheetSettings, what are used to decide many of spreadsheet behaviors and appearance. Sheet tab control and scroll bars are a part of workbook appearance, they could be hidden by following settings:

grid.SetSettings(WorkbookSettings.View_ShowSheetTabControl Or _
  WorkbookSettings.View_ShowScrolls, False)

Hide spreadsheet headers

The row header and column header are a part of each worksheet, to hide the headers of current selected worksheet, use the following code:

grid.CurrentWorksheet.SetSettings(WorksheetSettings.View_ShowHeaders, False)

The form shows spreadsheet like this:

176

Learn more about how to use ReoGrid

  • Download the build package and run Demo program
  • Check the Demo program source code to learn how to use ReoGrid (Demo programs are written in C#.NET but all code translate to VB.NET it will work properly)
  • Check documentation for API usage
  • Post your questions in forum

 


Return to FAQ

2 Responses to “How to use ReoGrid in VB.NET”

  1. fengjinzhi says:

    I want to use reogrid 0.86 in my project, but this version have Strong signed ,how can use?

    • jing says:

      There should no problems to reference a strongly signed assembly. Please post the details of your problem in forum, we’d like to help you.