Getting Started

To install ReoGrid into .NET applications, see installation.

Component Overview

215

Usually used objects:

Workbook and Worksheet

The control itself is also workbook, a control (workbook) contains multiple worksheets.

161

Call control (workbook) APIs:

var grid = this.reoGridControl;
grid.fun();

Call worksheet APIs:

var sheet = grid.CurrentWorksheet;
sheet.fun();

Access worksheet

Worksheet provides a lot of methods that could be used to manage cells data, styles, borders, outlines, ranges, formula calculation and etc. The below is an example that demos how to set cells data by call worksheet API.

Set cells data using worksheet index property:

// get current active worksheet instance
var sheet = grid.CurrentWorksheet;

// set cells data
sheet["A1"] = "hello world";
sheet[2, 1] = 10;

Or call SetCellData method:

sheet.SetCellData(new CellPosition(2, 1), "hello world");

Learn more about worksheet.

Access by doing actions

Action is undo-framework provided by ReoGrid core, many operations could be done by doing actions. Operations done via actions could be revoke by call Undo method of control. To do operations by using action:

1. Import this namespace:

using unvell.ReoGrid.Actions;

2. Call DoAction method of grid control

grid.DoAction(grid.CurrentWorksheet, new xxxxAction(...));

To undo or redo actions:

grid.Undo();
grid.Redo();

Repeatedly do last action, apply it to another range:

grid.RepeatLastAction(new RangePosition(2, 3, 5, 5));

Run script

In Extension edition, the ECMAScript-like script execution functionality is supported. It provides the ability to run script language in ReoGrid. Learn more about Script Execution.

To use this feature, make sure the required reference libraries are added into project. see Install.

To run script:

Import the namespace:

using unvell.ReoScript;

Call workbook API to run script:

string script = "workbook.currentWorksheet.getCell("B1").data = 'hello world';";
grid.RunScript(script);

The user applications can extend the script functions and objects to provide own customize script features, see Customize Function.


Next: Workbook