New to Telerik Document ProcessingStart a free 30-day trial

Manage View State

Updated on Jul 15, 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 worksheet zoom level to 50 percent

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: Scroll the worksheet so cell C11 becomes the top-left visible cell

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: Set two selection ranges and make C6 the active cell

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;

Worksheet showing two selected ranges, B3:E9 and D6:G13, with cell C6 as the active cell

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: Hide worksheet gridlines in the rendered view

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: Hide the row and column headers in the rendered view

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

Worksheet view with row and column headers hidden and gridlines turned off, leaving only the active cell visible

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: Set the worksheet tab color to green

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

Workbook with Sheet1 displayed using a green tab color while Sheet2 remains uncolored

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