Skip to main content
Row

RangeExtensions.Delete(CellRange, DeleteMode) Method

Deletes the cell range from the worksheet.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public static void Delete(
    this CellRange range,
    DeleteMode mode
)

Parameters

Name Type Description
range CellRange

A CellRange object specifying a cell range to be deleted from the worksheet.

mode DeleteMode

A DeleteMode enumeration member specifying in which direction to shift other cells.

Remarks

Use the Delete method to delete the cell range from the worksheet. This is an extension method of the CellRange object that is called by using the instance method syntax.

You can delete a cell range and shift other cells in the same column up, or shift other cells in the same row to the left. You can also delete entire rows and columns that comprise the cell range. In this case, other rows and columns are automatically shifted up or to the left. For more information on deleting rows and columns, refer to the How to: Delete a Row or Column from a Worksheet example.

To delete only cell content or formatting without removing entire cells from the worksheet, use the RangeExtensions.ClearContents, RangeExtensions.ClearFormats, RangeExtensions.ClearHyperlinks, RangeExtensions.ClearComments or RangeExtensions.Clear extension method of the range. To insert new cells, call the RangeExtensions.Insert method.

Another way to insert, delete and clear cells in the worksheet is to use the worksheet’s Worksheet.InsertCells, Worksheet.DeleteCells and Clear* methods (see the How to: Insert a Cell or Cell Range, How to: Delete a Cell or Range of Cells and How to: Clear Cells of Content, Formatting, Hyperlinks and Comments examples).

See Also