The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

Column.Insert() Method

Inserts a new column into the worksheet.

Namespace: DevExpress.Spreadsheet

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

Declaration

void Insert()
Sub Insert
void Insert()
Sub Insert
void Insert()
Sub Insert

Remarks

Use the Insert method to add a new column to the left of the current column. To add more than one column, use the ColumnCollection.Insert method.

Note

The number of columns in a worksheet is unchanged - 16,384. When you add new columns, the equivalent number of columns at the end are automatically removed from the worksheet.

To copy data (for example, values, formulas, formatting, etc.) from one column to another one, use the CellRange.CopyFrom method. For details, see the How to: Copy a Row or Column example.

Examples

This example demonstrates how to insert new columns into a worksheet.

Enclose your code in the Workbook.BeginUpdate - Workbook.EndUpdate method calls to improve performance when you add multiple columns to a document.

// Insert a new column C.
worksheet.Columns["C"].Insert();

// Insert a new column into the worksheet at the 5th position.
worksheet.Columns.Insert(4);

// Insert three columns into the worksheet at the 7th position.
worksheet.Columns.Insert(6, 3);

// Insert two columns to the left of the "L15:M16" cell range.
worksheet.InsertCells(worksheet.Range["L15:M16"], InsertCellsMode.EntireColumn);
See Also