Tips for using 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

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. See Excel file format.

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


Was the content of the page helpful?