Work with Regions and Ranges
mainBlazorDatasheet uses Regions to define geometric areas and Ranges to apply operations to those areas within a sheet.
- Region: A geometric construct (e.g.,
Region,ColumnRegion,RowRegion). - Range: A region that is aware of the
Sheet, allowing you to perform sheet-level operations like setting values or formats.
Common ways to create ranges include using A1 notation (e.g., "A1:C5"), using coordinate bounds, or passing a specific region object.
// Creating Regions
var region = new Region(0, 5, 0, 5); // r0 to r5, c0 to c5
var cellRegion = new Region(0, 0); // cell A1
var colRegion = new ColumnRegion(0, 4); // col region spanning A to D
var rowRegion = new RowRegion(0, 3); // row region spanning 1 to 4
// Creating Ranges from a Sheet
var range1 = sheet.Range("A1:C5");
var range2 = sheet.Range(new ColumnRegion(0));
var range3 = sheet.Range(0, 0, 4, 5);