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

SettingDescription
Behavior_DoubleClickToFitRowHeightAllow double-clicking to auto-fit row height
Behavior_DoubleClickToFitColumnWidthAllow double-clicking to auto-fit column width
Behavior_MouseWheelToScrollAllow scrolling with mouse wheel
Behavior_MouseWheelToZoomAllow zooming with Ctrl + mouse wheel
Behavior_ShortcutKeyToZoomAllow zooming with Ctrl+Plus / Ctrl+Minus
Behavior_DragToMoveCellsAllow moving or copying selection by dragging
Behavior_DragToMoveColumnHeaderAllow moving column by dragging header (reserved)
Behavior_ScrollToFocusCellAlways scroll to keep the focused cell visible
Behavior_AllowUserChangingPageBreaksAllow user to adjust page breaks with mouse

Editing Settings

SettingDescription
Edit_ReadonlyMake the worksheet read-only
Edit_AutoFormatCellAuto-format data after user input
Edit_FriendlyPercentInputShow % symbol during percent-formatted cell input
Edit_AutoAdjustRowHeightAuto-adjust row height when font size increases
Edit_AllowAdjustRowHeightAllow user to drag row height
Edit_AllowAdjustColumnWidthAllow user to drag column width
Edit_DragSelectionToMoveCellsAllow drag-and-drop to move cell content
Edit_DragSelectionToFillSerialAllow drag to auto-fill

Appearance Settings

SettingDescription
View_ShowColumnHeaderShow column headers
View_ShowRowHeaderShow row headers
View_ShowHorizontalRulerShow horizontal ruler (reserved)
View_ShowVerticalRulerShow vertical ruler (reserved)
View_ShowGuideLineShow grid lines
View_ShowHiddenCellLineShow indicator line for hidden rows/columns
View_AllowShowRowOutlinesShow row outline panel
View_AllowShowColumnOutlinesShow column outline panel
View_ShowPageBreaksShow page-break lines
View_AllowCellTextOverflowAllow cell text to overflow into adjacent cells
View_ShowPrintAreasEnableShow print area boundaries

Formula Settings

SettingDescription
Formula_AutoUpdateReferenceCellAuto-update formula references when rows/columns change
Formula_AutoPickingAddressAllow picking cell addresses during formula editing
Formula_AutoFormatAuto-correct and format formulas

WorksheetOptions

The Options property provides additional configuration with value-based settings:

var options = sheet.Options;

Formula Calculation Options

PropertyTypeDefaultDescription
FormulaCalculationTimingenumAutoWhen to calculate formulas (Auto, OnDemand, etc.)
FormulaCalculationPrecisionenumDoublePrecision for formula calculations

Selection Options

PropertyTypeDefaultDescription
AlwaysMoveSelectionToUnlockedCellboolfalseAuto-move selection to unlocked cells when worksheet is locked
AllowSelectCellWhenHitDropdownCellbooltrueAllow cell selection when clicking a dropdown cell

Scrollbar Options

PropertyTypeDefaultDescription
AutoHideHorizontalScrollBarboolfalseAuto-hide horizontal scrollbar when not needed
AutoHideVerticalScrollBarboolfalseAuto-hide vertical scrollbar when not needed

Async Processing Options

These options control asynchronous cell processing for large worksheets:

PropertyTypeDefaultDescription
AutoSuspendProcessesForFasterDataLoadingboolfalseSuspend processes during bulk data loading for better performance
AllowAsyncProcessboolfalseEnable asynchronous cell processing
AsyncProcessDelayintโ€”Delay before async processing starts (ms)
AsyncProcessIntervalTimeintโ€”Interval between async processing batches (ms)
AsyncProcessBatchSizeintโ€”Number of cells to process per batch

Example: Configure for Large Data

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();
Was this article helpful?