Back to Devexpress

CellValue.NumericValue Property

officefileapi-devexpress-dot-spreadsheet-dot-cellvalue-3ec381b0.md

latest7.7 KB
Original Source

CellValue.NumericValue Property

Returns a number contained in a cell.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public double NumericValue { get; }
vb
Public ReadOnly Property NumericValue As Double

Property Value

TypeDescription
Double

A Double value specifying a cell value of the numeric type.

|

Remarks

Use the NumericValue property to obtain the number contained in a cell. To check whether the cell value is of the numeric type, use the CellValue.IsNumeric or CellValue.Type property. To get a string that specifies a numeric value as it is displayed in the cell according to the applied number format, use the Cell.DisplayText property.

Note

Note, that dates and times are stored in cells as numbers that are displayed according to the applied date and time formats. So, if a cell contains a number, the CellValue.DateTimeValue property returns the DateTime object, which specifies a date and time value corresponding to that number.

For more information on cell values, refer to the Cell Data Types document.

The following code snippets (auto-collected from DevExpress Examples) contain references to the NumericValue property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

spreadsheet-document-api-create-loan-amortization-schedule-within-blazor-server-app/CS/BlazorAppSpreadsheet/Code/DocumentGenerator.cs#L23

csharp
{
    get { return Sheet["E4"].Value.NumericValue; }
    set { Sheet["E4"].Value = value; }

winforms-spreadsheetcontrol-api-part-3/CS/SpreadsheetControl_API_Part03/CodeExamples/RowAndColumnActions.cs#L14

csharp
// Create a function specifying the condition to remove worksheet rows.
Func<int, bool> rowRemovalCondition = x => worksheet.Cells[x, 0].Value.NumericValue > 3.0 && worksheet.Cells[x, 0].Value.NumericValue < 14.0;

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/RowAndColumnActions.cs#L17

csharp
// Create a function specifying the condition to remove worksheet rows.
Func<int, bool> rowRemovalCondition = x => worksheet.Cells[x, 0].Value.NumericValue > 3.0 && worksheet.Cells[x, 0].Value.NumericValue < 14.0;

spreadsheet-document-api-examples-part1/CS/SpreadsheetExamples/SpreadsheetActions/RowAndColumnActions.cs#L233

csharp
// and less than 14, remove the corresponding row.
Func<int, bool> rowRemovalCondition = x => worksheet.Cells[x, 0].Value.NumericValue > 3.0 && worksheet.Cells[x, 0].Value.NumericValue < 14.0;

asp-net-mvc-spreadsheet-send-ajax-requests-to-server-to-get-cell-values/CS/T318446/Controllers/HomeController.cs#L20

csharp
IWorkbook myWorkBook = SpreadsheetExtension.GetCurrentDocument("Spreadsheet");
int test = Convert.ToInt32(myWorkBook.Worksheets[0].Cells["B3"].Value.NumericValue);
return Json(test);

winforms-spreadsheetcontrol-api-part-3/VB/SpreadsheetControl_API_Part03/CodeExamples/RowAndColumnActions.vb#L13

vb
' Create a function specifying the condition to remove worksheet rows.
Dim rowRemovalCondition As System.Func(Of Integer, Boolean) = Function(x) worksheet.Cells(CInt((x)), CInt((0))).Value.NumericValue > 3.0 AndAlso worksheet.Cells(CInt((x)), CInt((0))).Value.NumericValue < 14.0
' Fill cells with data.

spreadsheet-document-api-examples-part1/VB/SpreadsheetExamples/SpreadsheetActions/RowAndColumnActions.vb#L189

vb
' and less than 14, remove the corresponding row.
Dim rowRemovalCondition As Func(Of Integer, Boolean) = Function(x) worksheet.Cells(x, 0).Value.NumericValue > 3.0 AndAlso worksheet.Cells(x, 0).Value.NumericValue < 14.0

asp-net-mvc-spreadsheet-send-ajax-requests-to-server-to-get-cell-values/VB/T318446/Controllers/HomeController.vb#L20

vb
Dim myWorkBook As IWorkbook = SpreadsheetExtension.GetCurrentDocument("Spreadsheet")
Dim test As Integer = Convert.ToInt32(myWorkBook.Worksheets(0).Cells("B3").Value.NumericValue)
Return Json(test)

See Also

IsNumeric

BooleanValue

DateTimeValue

TextValue

ErrorValue

Cell Data Types

CellValue Class

CellValue Members

DevExpress.Spreadsheet Namespace