Back to Devexpress

ValueObject.FromRange(CellRange) Method

officefileapi-devexpress-dot-spreadsheet-dot-valueobject-dot-fromrange-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md

latest8.0 KB
Original Source

ValueObject.FromRange(CellRange) Method

Creates the ValueObject instance that originates from the worksheet range.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public static ValueObject FromRange(
    CellRange range
)
vb
Public Shared Function FromRange(
    range As CellRange
) As ValueObject

Parameters

NameTypeDescription
rangeCellRange

A CellRange object that specifies the worksheet Range.

|

Returns

TypeDescription
ValueObject

A ValueObject instance.

|

Remarks

Use the ValueObject.RangeValue property to obtain the range from the created object. To determine whether the ValueObject originates from the range, check the ValueObject.IsRange property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FromRange(CellRange) method.

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.

winforms-spreadsheetcontrol-api-part-3/CS/SpreadsheetControl_API_Part03/CodeExamples/DataValidationActions.cs#L35

csharp
// Restrict data entry to values in a drop-down list obtained from a worksheet.
worksheet.DataValidations.Add(worksheet["E4:E11"], DataValidationType.List, ValueObject.FromRange(worksheet["H4:H9"].GetRangeWithAbsoluteReference()));

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/DataValidationActions.cs#L47

csharp
// Restrict data entry to values in a drop-down list obtained from a worksheet.
worksheet.DataValidations.Add(worksheet["E4:E11"], DataValidationType.List, ValueObject.FromRange(worksheet["H4:H9"].GetRangeWithAbsoluteReference()));

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/DataValidationActions.cs#L53

csharp
// Restrict data entry to values in a drop-down list obtained from a worksheet.
worksheet.DataValidations.Add(worksheet["E4:E11"], DataValidationType.List, ValueObject.FromRange(worksheet["H4:H9"].GetRangeWithAbsoluteReference()));

wpf-spreadsheet-assign-custom-in-place-editors/CS/WpfSpreadsheet_CustomCellEditors/MainWindow.xaml.cs#L39

csharp
CellRange comboBoxRange = worksheet["Table[Category]"];
worksheet.CustomCellInplaceEditors.Add(comboBoxRange, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(worksheet["J3:J9"]));

winforms-spreadsheet-assign-custom-in-place-editors/CS/Spreadsheet_CustomCellEditors/Form1.cs#L39

csharp
CellRange comboBoxRange = worksheet["Table[Category]"];
worksheet.CustomCellInplaceEditors.Add(comboBoxRange, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(worksheet["J3:J9"]));

winforms-spreadsheetcontrol-api-part-3/VB/SpreadsheetControl_API_Part03/CodeExamples/DataValidationActions.vb#L29

vb
' Restrict data entry to values in a drop-down list obtained from a worksheet.
worksheet.DataValidations.Add(worksheet("E4:E11"), DevExpress.Spreadsheet.DataValidationType.List, DevExpress.Spreadsheet.ValueObject.FromRange(worksheet(CStr(("H4:H9"))).GetRangeWithAbsoluteReference()))
' Restrict data entry to a time before the specified time.

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/DataValidationActions.vb#L51

vb
' Restrict data entry to values in a drop-down list obtained from a worksheet.
worksheet.DataValidations.Add(worksheet("E4:E11"), DataValidationType.List, ValueObject.FromRange(worksheet("H4:H9").GetRangeWithAbsoluteReference()))

winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L39

vb
Dim customers As Worksheet = workbook.Worksheets("Customers")
invoice.CustomCellInplaceEditors.Add(invoice("B10:C10"), CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(customers("A2:A21")))
' Use a combo box editor as the in-place editor for cells containing the store location in the Shipping Address section.

wpf-spreadsheet-assign-custom-in-place-editors/VB/WpfSpreadsheet_CustomCellEditors/MainWindow.xaml.vb#L34

vb
Dim comboBoxRange As CellRange = worksheet("Table[Category]")
worksheet.CustomCellInplaceEditors.Add(comboBoxRange, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(worksheet("J3:J9")))
' Use a check editor as the in-place editor for cells located in the "Discount" column of the worksheet table.

winforms-spreadsheet-assign-custom-in-place-editors/VB/Spreadsheet_CustomCellEditors/Form1.vb#L34

vb
Dim comboBoxRange As CellRange = worksheet("Table[Category]")
worksheet.CustomCellInplaceEditors.Add(comboBoxRange, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(worksheet("J3:J9")))
' Use a check editor as the in-place editor for cells located in the "Discount" column of the worksheet table.

See Also

ValueObject Class

ValueObject Members

DevExpress.Spreadsheet Namespace