Version

Inserting and Deleting Cells, Column and Rows (Infragistics Excel Engine)

Topic Overview

Purpose

This topic explains how to manage worksheet’s cells, columns and rows.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

In this section you will find information that will help you to better understand the object model and the functionalities of the Infragistics Excel Engine.

In order to get you up and running as quickly as possible with the Infragistics Excel Engine, this topic provides procedural instructions on how to create a workbook.

Insert/Delete Cell(s) Summary

Insert/delete cell(s) summary

The Infragistics Excel Engine supports inserting of new cell(s) and removing of existing cell(s) using methods located in the Worksheet class.

Insert/delete cell(s) summary chart

The following table explains briefly the available functionality for inserting and deleting worksheet cell(s). Further details are available after the table.

Operation Details Method(s)

Insert one or more cell(s)

Delete one or more cell(s)

Insert or delete one or more column(s)

Insert or delete one or more row(s)

Insert Cell(s)

Overview

The Infragistics Excel Engine supports inserting of one or more new cell(s) by specifying the location at which the insert process should occur. The cell(s) already located at the specified address(es) will be shifted to the right or below. You can specify the address(es) for the new cell(s) using a string or a WorksheetRegion.

Here are some examples of specifying addresses using a string:

  • “C5” - this will insert one single cell at column C, row 5

  • “D8:D10” – this will insert 3 cells in column D, rows 8, 9 and 10

  • “E11:G15” – this will insert a block of cells which stretch from column E to column G and from row 11 to row 15

Note
Note

You cannot insert or delete cells in a location where it would split merged cells, tables or array formulas or if an insertion would cause cell data to be shifted off the right or bottom of the worksheet. The methods below will throw an InvalidOperationException if any of these scenarios are detected.

Property settings

The following table maps the desired functionality to the method that invokes it.

In order to: Use this method: And provide the following arguments:

Insert cell(s)

  • The address(es) in either string or WorksheetRegion format

  • Direction in which the existing cells to be shifted (false for down, true for right)

Delete Cell(s)

Overview

The Infragistics Excel Engine supports deleting of one or more existing cell(s) by specifying the location at which the deletion process should occur. The “empty” location will be filled with cells from either right or below the deleted cell(s). You can specify the address(es) for the cell(s) to be deleted using string or WorksheetRegion.

Note
Note

For example on how to specify address(es) using string see the insert cell(s) operation above.

Property settings

The following table maps the desired functionality to the method that invokes it.

In order to: Use this method: And provide the following arguments:

Delete cell(s)

  • The address(es) in either string or WorksheetRegion format

  • Direction in which the existing cells to be shifted to replace the deleted cell(s) (false for up, true for left)

Insert or Delete Column(s)

Overview

The Infragistics Excel Engine supports inserting and deleting column(s) using the Insert and Remove methods of the worksheet’s Columns collection.

Property settings

The following table maps the desired functionality to the method that invokes it.

In order to: Use this method: And provide the following arguments:

Insert new column(s)

Insert

  • Location index (0-based) for inserting new column(s)

  • Number of column(s) to be inserted (if you omit this argument one column will be inserted)

Delete existing column(s)

Remove

  • Location index (0-based) for deleting existing column(s)

  • Number of column(s) to be deleted (if you omit this argument one column will be deleted)

Insert or Delete Row(s)

Overview

The Infragistics Excel Engine supports inserting and deleting row(s) using the Insert and Remove methods of the worksheet’s Rows collection.

Property settings

The following table maps the desired functionality to the method that invokes it.

In order to: Use this method: And provide the following arguments:

Insert new row(s)

Insert

  • Location index (0-based) for inserting new row(s)

  • Number of row(s) to be inserted (if you omit this argument one row will be inserted)

Delete existing row(s)

Remove

  • Location index (0-based) for deleting existing row(s)

  • Number of row(s) to be deleted (if you omit this argument one row will be deleted)

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to merge several Worksheet cells and how to set the format of the merged cells region.

This topic explains how to access a cell and a region by a string reference.