Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelRangeDataValidationBuilder

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
9931e96ab849 with working tree changes
Modifiers
sealed

Adds data validation rules to an ExcelRange.

Inheritance

  • object
  • ExcelRangeDataValidationBuilder

Remarks

Existing rules are listed, edited and removed through the worksheet (ExcelSheet.GetDataValidations, ExcelSheet.SetDataValidationMessages, ExcelSheet.UpdateDataValidationMessages, ExcelSheet.RemoveDataValidations).

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Methods

public ExcelRange CustomFormula(string formula, bool allowBlank = true, string? errorTitle = null, string? errorMessage = null) #

Accepts input when a custom formula evaluates to true.

Parameters

formula string required
allowBlank bool = true optional
errorTitle string? = null optional
errorMessage string? = null optional

Returns

ExcelRange
public ExcelRange Date(ExcelDataValidationOperator operator, DateTime formula1, DateTime? formula2 = null, bool allowBlank = true, string? errorTitle = null, string? errorMessage = null) #

Restricts input to dates; Between and NotBetween need formula2.

Parameters

operator OfficeIMO.Excel.ExcelDataValidationOperator required
formula1 System.DateTime required
formula2 System.DateTime? = null optional
allowBlank bool = true optional
errorTitle string? = null optional
errorMessage string? = null optional

Returns

ExcelRange
public ExcelRange Decimal(ExcelDataValidationOperator operator, double formula1, double? formula2 = null, bool allowBlank = true, string? errorTitle = null, string? errorMessage = null) #

Restricts input to decimal numbers; Between and NotBetween need formula2.

Parameters

operator OfficeIMO.Excel.ExcelDataValidationOperator required
formula1 double required
formula2 double? = null optional
allowBlank bool = true optional
errorTitle string? = null optional
errorMessage string? = null optional

Returns

ExcelRange
List 2 overloads
public ExcelRange List(params string[] items) #

Restricts input to a drop-down list of inline items.

Parameters

items string[] required

Returns

ExcelRange
public ExcelRange List(IEnumerable<string> items, bool allowBlank = true) #

Restricts input to a drop-down list of inline items.

Parameters

items System.Collections.Generic.IEnumerable<string> required
allowBlank bool = true optional

Returns

ExcelRange
public ExcelRange ListNamedRange(string namedRange, bool allowBlank = true) #

Restricts input to a drop-down list read from a workbook or sheet-local named range.

Parameters

namedRange string required
allowBlank bool = true optional

Returns

ExcelRange
public ExcelRange ListRange(string sourceA1Range, string? sourceSheetName = null, bool allowBlank = true) #

Restricts input to a drop-down list read from a worksheet range; the current sheet when no sheet is named.

Parameters

sourceA1Range string required
sourceSheetName string? = null optional
allowBlank bool = true optional

Returns

ExcelRange
public ExcelRange TextLength(ExcelDataValidationOperator operator, int formula1, int? formula2 = null, bool allowBlank = true, string? errorTitle = null, string? errorMessage = null) #

Restricts the length of text input; Between and NotBetween need formula2.

Parameters

operator OfficeIMO.Excel.ExcelDataValidationOperator required
formula1 int required
formula2 int? = null optional
allowBlank bool = true optional
errorTitle string? = null optional
errorMessage string? = null optional

Returns

ExcelRange
public ExcelRange Time(ExcelDataValidationOperator operator, TimeSpan formula1, TimeSpan? formula2 = null, bool allowBlank = true, string? errorTitle = null, string? errorMessage = null) #

Restricts input to times of day; Between and NotBetween need formula2.

Parameters

operator OfficeIMO.Excel.ExcelDataValidationOperator required
formula1 System.TimeSpan required
formula2 System.TimeSpan? = null optional
allowBlank bool = true optional
errorTitle string? = null optional
errorMessage string? = null optional

Returns

ExcelRange
public ExcelRange WholeNumber(ExcelDataValidationOperator operator, int formula1, int? formula2 = null, bool allowBlank = true, string? errorTitle = null, string? errorMessage = null) #

Restricts input to whole numbers; Between and NotBetween need formula2.

Parameters

operator OfficeIMO.Excel.ExcelDataValidationOperator required
formula1 int required
formula2 int? = null optional
allowBlank bool = true optional
errorTitle string? = null optional
errorMessage string? = null optional

Returns

ExcelRange