V4 V5

Multiple Format Support

ReoGrid supports loading and saving the Excel xlsx file format, importing and exporting CSV files, outputting spreadsheets to a printer or print preview, and generating worksheets as HTML or PDF.

245

Workbook Input & Output API

The ReoGrid control itself acts as a workbook. Both the screen workbook control and the memory workbook share the same APIs.

var workbook = reoGridControl;

// To load an Excel workbook:
workbook.Load(path, IO.FileFormat.Excel2007);

// ReoGrid will automatically create and load all worksheets from the Excel file.
// To save an Excel file:
workbook.Save(path, IO.FileFormat.Excel2007);

Supported objects

Loading and saving the following objects from/to an Excel file is supported:

Not supported objects

Loading and saving the following objects is not yet supported:

  • Conditional style triggers
  • Pivot tables & database connections
  • Some formula functions & VBA

Loading workbooks with many sheets

Since v4.5.1, WorksheetLoadStrategy chooses how the worksheets of a multi-sheet XLSX file are loaded. Set it before calling Load:

// Default: every worksheet is parsed during Load
grid.WorksheetLoadStrategy = WorksheetLoadStrategy.LoadAll;

// Only the active worksheet is parsed during Load; the others on first access,
// e.g. when their sheet tab is clicked
grid.WorksheetLoadStrategy = WorksheetLoadStrategy.DelayLoad;

// Like DelayLoad, while a background task preloads the remaining worksheets
grid.WorksheetLoadStrategy = WorksheetLoadStrategy.BackgroundDelayLoad;

grid.Load(path, IO.FileFormat.Excel2007);
ValueBehavior
LoadAllEvery worksheet is parsed during Load (default)
DelayLoadFastest to open. The first access to a large worksheet waits until that worksheet is parsed; a busy cursor is shown meanwhile
BackgroundDelayLoadOpens as fast as DelayLoad, and switching tabs usually finds the worksheet already loaded. A worksheet accessed before the background task reaches it is parsed on demand

Available function list

See Excel-Compatible Function List.

Memory Workbook

ReoGrid also provides an off-screen interface that can load and save spreadsheets without a GUI. This feature is typically used for importing and exporting Excel files and processing data in the background or on the server side.

Typical usage of memory workbook

Create a memory workbook instance, then load or save the spreadsheet in Excel format.

// create memory workbook
var workbook = ReoGridControl.CreateMemoryWorkbook();

// load Excel workbook from stream
workbook.Load(stream, FileFormat.Excel2007);
// save stream as Excel workbook
workbook.Save(stream, FileFormat.Excel2007);

Learn more about memory workbook.

Was this article helpful?