Skip to main content
Row

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

RowCollection.Insert(Int32, Int32, RowFormatMode) Method

Inserts multiple rows and specifies how to format these rows.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

void Insert(
    int index,
    int count,
    RowFormatMode formatMode
)

#Parameters

Name Type Description
index Int32

A zero-based index of the first row to insert. If the index is negative or exceeds the last available index (1048575), an exception occurs.

count Int32

The number of rows to insert.

formatMode RowFormatMode

An enumeration member that specifies how to format inserted rows.

#Remarks

The number of rows in a worksheet does not change—1,048,576. When you add new rows, the rows below are shifted down and an equivalent number of rows at the end of the worksheet is removed.

The following example inserts two rows above the second row in a worksheet and applies the same format as the first row to these rows:

// Insert two rows with the same formatting as the first row.
worksheet.Rows.Insert(1, 2, RowFormatMode.FormatAsPrevious);

Insert rows and specify format options

See Also