Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WorksheetDisplayArea.SetSize(Int32, Int32, Int32) Method

Defines the number of visible columns and rows for the specified worksheet.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.2.dll

NuGet Package: DevExpress.Win.Spreadsheet

#Declaration

public void SetSize(
    int worksheetIndex,
    int maxColumnCount,
    int maxRowCount
)

#Parameters

Name Type Description
worksheetIndex Int32

An integer that is the zero-based index of the worksheet whose visible area should be restricted.

maxColumnCount Int32

An integer that represents the maximum number of columns to be displayed in a worksheet. The value must be a whole number between 1 and 16,384.

maxRowCount Int32

An integer that represents the maximum number of rows to be displayed in a worksheet. The value must be a whole number between 1 and 1,048,576.

#Remarks

This example demonstrates how to display only 5 rows and 5 columns in a worksheet.

spreadsheetControl1.WorksheetDisplayArea.SetSize(0, 5, 5);

The image below shows the result.

VisibleArea

Note that the SetSize method does not affect API methods, so you can change cell content and formatting in code.

To restore the restricted visible area to the default size with all rows and columns visible, use the WorksheetDisplayArea.Reset method.

See Also