officefileapi-devexpress-dot-spreadsheet-dot-valueobject-dot-fromrange-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md
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
public static ValueObject FromRange(
CellRange range
)
Public Shared Function FromRange(
range As CellRange
) As ValueObject
| Name | Type | Description |
|---|---|---|
| range | CellRange |
A CellRange object that specifies the worksheet Range.
|
| Type | Description |
|---|---|
| ValueObject |
A ValueObject instance.
|
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.
// 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()));
// 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()));
// 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()));
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
CellRange comboBoxRange = worksheet["Table[Category]"];
worksheet.CustomCellInplaceEditors.Add(comboBoxRange, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(worksheet["J3:J9"]));
' 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.
' 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
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.
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
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