Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RangeExtensions.ClearContents(CellRange) Method

Removes cell content.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

public static void ClearContents(
    this CellRange range
)

#Parameters

Name Type Description
range CellRange

A CellRange 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 CellRange object that is called by using the instance method syntax.

Another way to delete content from cells is to set the CellRange.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