Skip to main content
Row

ColumnCollection.Insert(Int32, Int32) Method

Inserts multiple columns into the worksheet.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

void Insert(
    int index,
    int count
)

Parameters

Name Type Description
index Int32

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

count Int32

The number of columns to insert.

Remarks

The number of columns in a worksheet does not change—16,384. When you add new columns, other columns in the worksheet are shifted to the right, and an equivalent number of columns at the end of the worksheet is removed.

The following example demonstrates how to add multiple columns to a worksheet:

// Insert three columns (from column "B" to column "D").
worksheet.Columns.Insert(1, 3);

// Insert two columns starting with column "F".
worksheet.Columns.Insert("F", 2);

Insert multiple columns

The following code snippets (auto-collected from DevExpress Examples) contain references to the Insert(Int32, Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also