Skip to main content
All docs
V19.1
.NET Framework 4.5.2+
Row

RangeExtensions.ClearContents(Range) Method

Removes cell content.

Namespace: DevExpress.Spreadsheet

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

Declaration

public static void ClearContents(
    this Range range
)

Parameters

Name Type Description
range Range

A Range object specifying the cell range to clear.

Remarks

The ClearContents method removes cell data (value and formula) only. Cell formatting and comments remain unchanged. This is an extension method of the Range object that is called by using the instance method syntax.

Another way to delete content from cells is to set the Range.Value property to null or to CellValue.Empty.

To separately remove cell formatting, hyperlinks, comments or clear a cell range completely, call the RangeExtensions.ClearFormats, RangeExtensions.ClearHyperlinks, RangeExtensions.ClearComments or RangeExtensions.Clear method, respectively. To delete entire cells from the worksheet, use the RangeExtensions.Delete method.

To clear cells, you can also use the Clear* methods of the Worksheet object (see the How to: Clear Cells of Content, Formatting, Hyperlinks and Comments example).

See Also