Skip to main content

WorksheetDisplayArea.SetSize(Int32, Int32, Int32) Method

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

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v23.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