Skip to main content

WorksheetDisplayArea.SetSize(String, Int32, Int32) Method

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

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.1.dll

NuGet Package: DevExpress.Win.Spreadsheet

Declaration

public void SetSize(
    string worksheetName,
    int maxColumnCount,
    int maxRowCount
)

Parameters

Name Type Description
worksheetName String

A string value specifying the name 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("Sheet1", 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