Skip to main content
All docs
V24.2
Row

ColumnCollection.Insert(Int32, Int32, ColumnFormatMode) Method

Inserts multiple columns and specifies how to format these columns.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

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

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.

formatMode ColumnFormatMode

An enumeration member that specifies how to format inserted columns.

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 inserts two columns (“B” and “C”) and applies the same format as column “A” to these columns:

// Insert two columns with the same formatting as the column "A".
worksheet.Columns.Insert(1, 2, ColumnFormatMode.FormatAsPrevious);

Insert columns and specify format options

See Also