New to Telerik Document ProcessingStart a free 30-day trial

Manage View State

Updated on Jun 16, 2026

RadSpreadProcessing enables you to apply different properties on the worksheet that affect its visualization when the document is rendered in an application. You can access these properties through the ViewState property of the Worksheet object.

The following sections describe the members of the WorksheetViewState class.

ScaleFactor

Gets or sets the current scale factor of the worksheet. Use this property to zoom in or out according to your needs. The values you can apply are between 0.5 and 4, corresponding to 50% and 400% respectively.

Example 1: Set the Zoom Level of a Worksheet to 50%

C#
workbook.Worksheets[0].ViewState.ScaleFactor = new Size(0.5, 0.5);

TopLeftCellIndex

Determines the top left cell visible on the screen. Use this property to make sure that the data you want to visualize when the worksheet is opened is in the user viewport.

Example 2: Set the Top Left Cell to Be C11

C#
workbook.Worksheets[0].ViewState.TopLeftCellIndex = new CellIndex(10, 2);

SelectionState

Gets or sets the state of the selection inside the worksheet.

Example 3 demonstrates how you can create two selection ranges (one from B3 to E9 and one from D6 to G13) and change the active cell inside that selection.

Example 3: Change the Selection

C#
CellIndex selectionActiveCellIndex = new CellIndex(5, 2); // C6
List<CellRange> selectionRanges = new List<CellRange>()
    {
        new CellRange(new CellIndex(3, 1), new CellIndex(8, 4)),// B3:E9 
        new CellRange(new CellIndex(5, 3), new CellIndex(12, 6)),// D6:G13
    };

SelectionState selectionState = new SelectionState(selectionRanges, selectionActiveCellIndex, ViewportPaneType.Scrollable);
workbook.Worksheets[0].ViewState.SelectionState = selectionState;

Selection state showing two selected ranges in a worksheet

IsSelected

Gets or sets a value indicating whether the sheet is selected.

ShowGridLines

Gets or sets a boolean value determining whether the gridlines are visualized when the document is rendered.

Example 4: Remove Grid Lines

C#
workbook.Worksheets[0].ViewState.ShowGridLines = false;

ShowRowColHeaders

Determines whether the headers of the rows and columns are visualized when the document is rendered.

Example 5: Remove Row and Column Headers

C#
workbook.Worksheets[0].ViewState.ShowRowColHeaders = false;

Worksheet with hidden row and column headers and grid lines

Pane

Gets or sets the pane of the worksheet. Applicable when the worksheet contains frozen panes.

CircleInvalidData

Gets or sets a value indicating whether to circle the not valid data. Applicable when using the Data Validation feature. This property is not preserved when exporting the document because there is no alternative representation in the supported formats. Its value is used only by viewers integrated with SpreadProcessing.

FreezePanes

Allows you to freeze panes. For more information about this feature and its usage, refer to the Freeze Panes topic.

TabColor

Sets the color of the worksheet tab.

Example 6: Change the Color of the Tab

C#
workbook.Worksheets[0].ViewState.TabColor = new ThemableColor(Colors.Green);

Worksheet with green tab color

IsInvalidated

Boolean property determining whether the view state must be updated.

ViewType

Sets the view type. The supported values are Normal, PageBreakPreview, and PageLayout.

See Also