ReoGrid provides two mechanisms for controlling worksheet behavior: WorksheetSettings (flags-based on/off settings) and WorksheetOptions (value-based configuration).
WorksheetSettings
Methods
var sheet = reoGridControl.CurrentWorksheet;
// Enable a setting
sheet.EnableSettings(WorksheetSettings.Edit_Readonly);
// Disable a setting
sheet.DisableSettings(WorksheetSettings.Edit_Readonly);
// Set with explicit boolean
sheet.SetSettings(WorksheetSettings.Edit_Readonly, true);
// Check if a setting is enabled
bool isReadonly = sheet.HasSettings(WorksheetSettings.Edit_Readonly);
Events
sheet.SettingsChanged += (s, e) =>
{
Console.WriteLine("Settings changed");
};
Behavior Settings
| Setting | Description |
|---|
Behavior_DoubleClickToFitRowHeight | Allow double-clicking to auto-fit row height |
Behavior_DoubleClickToFitColumnWidth | Allow double-clicking to auto-fit column width |
Behavior_MouseWheelToScroll | Allow scrolling with mouse wheel |
Behavior_MouseWheelToZoom | Allow zooming with Ctrl + mouse wheel |
Behavior_ShortcutKeyToZoom | Allow zooming with Ctrl+Plus / Ctrl+Minus |
Behavior_DragToMoveCells | Allow moving or copying selection by dragging |
Behavior_DragToMoveColumnHeader | Allow moving column by dragging header (reserved) |
Behavior_ScrollToFocusCell | Always scroll to keep the focused cell visible |
Behavior_AllowUserChangingPageBreaks | Allow user to adjust page breaks with mouse |
Editing Settings
| Setting | Description |
|---|
Edit_Readonly | Make the worksheet read-only |
Edit_AutoFormatCell | Auto-format data after user input |
Edit_FriendlyPercentInput | Show % symbol during percent-formatted cell input |
Edit_AutoAdjustRowHeight | Auto-adjust row height when font size increases |
Edit_AllowAdjustRowHeight | Allow user to drag row height |
Edit_AllowAdjustColumnWidth | Allow user to drag column width |
Edit_DragSelectionToMoveCells | Allow drag-and-drop to move cell content |
Edit_DragSelectionToFillSerial | Allow drag to auto-fill |
Appearance Settings
| Setting | Description |
|---|
View_ShowColumnHeader | Show column headers |
View_ShowRowHeader | Show row headers |
View_ShowHorizontalRuler | Show horizontal ruler (reserved) |
View_ShowVerticalRuler | Show vertical ruler (reserved) |
View_ShowGuideLine | Show grid lines |
View_ShowHiddenCellLine | Show indicator line for hidden rows/columns |
View_AllowShowRowOutlines | Show row outline panel |
View_AllowShowColumnOutlines | Show column outline panel |
View_ShowPageBreaks | Show page-break lines |
View_AllowCellTextOverflow | Allow cell text to overflow into adjacent cells |
View_ShowPrintAreasEnable | Show print area boundaries |
| Setting | Description |
|---|
Formula_AutoUpdateReferenceCell | Auto-update formula references when rows/columns change |
Formula_AutoPickingAddress | Allow picking cell addresses during formula editing |
Formula_AutoFormat | Auto-correct and format formulas |
WorksheetOptions
The Options property provides additional configuration with value-based settings:
var options = sheet.Options;
| Property | Type | Default | Description |
|---|
FormulaCalculationTiming | enum | Auto | When to calculate formulas (Auto, OnDemand, etc.) |
FormulaCalculationPrecision | enum | Double | Precision for formula calculations |
Selection Options
| Property | Type | Default | Description |
|---|
AlwaysMoveSelectionToUnlockedCell | bool | false | Auto-move selection to unlocked cells when worksheet is locked |
AllowSelectCellWhenHitDropdownCell | bool | true | Allow cell selection when clicking a dropdown cell |
| Property | Type | Default | Description |
|---|
AutoHideHorizontalScrollBar | bool | false | Auto-hide horizontal scrollbar when not needed |
AutoHideVerticalScrollBar | bool | false | Auto-hide vertical scrollbar when not needed |
Async Processing Options
These options control asynchronous cell processing for large worksheets:
| Property | Type | Default | Description |
|---|
AutoSuspendProcessesForFasterDataLoading | bool | false | Suspend processes during bulk data loading for better performance |
AllowAsyncProcess | bool | false | Enable asynchronous cell processing |
AsyncProcessDelay | int | โ | Delay before async processing starts (ms) |
AsyncProcessIntervalTime | int | โ | Interval between async processing batches (ms) |
AsyncProcessBatchSize | int | โ | Number of cells to process per batch |
var options = sheet.Options;
// Enable async processing for better performance with large datasets
options.AllowAsyncProcess = true;
options.AsyncProcessBatchSize = 1000;
options.AsyncProcessIntervalTime = 50;
// Suspend processes during bulk loading
options.AutoSuspendProcessesForFasterDataLoading = true;
Copy and Clone Options
// Copy options from another worksheet
sheet.Options.CopyFrom(otherSheet.Options);
// Clone options for a new worksheet
var newOptions = sheet.Options.Clone(newSheet);
Common Configuration Patterns
Read-Only Worksheet
sheet.SetSettings(WorksheetSettings.Edit_Readonly, true);
Hide All UI Chrome
sheet.SetSettings(WorksheetSettings.View_ShowRowHeader, false);
sheet.SetSettings(WorksheetSettings.View_ShowColumnHeader, false);
sheet.SetSettings(WorksheetSettings.View_ShowGuideLine, false);
Disable User Resizing
sheet.SetSettings(WorksheetSettings.Edit_AllowAdjustRowHeight, false);
sheet.SetSettings(WorksheetSettings.Edit_AllowAdjustColumnWidth, false);
sheet.SetSettings(WorksheetSettings.Behavior_DoubleClickToFitRowHeight, false);
sheet.SetSettings(WorksheetSettings.Behavior_DoubleClickToFitColumnWidth, false);
Optimize for Bulk Data Loading
sheet.Options.AutoSuspendProcessesForFasterDataLoading = true;
sheet.SuspendConditionalStyleUpdate = true;
// Load data...
sheet.SuspendConditionalStyleUpdate = false;
sheet.ApplyAllConditionalStyles();