Class ExcelDataValidation
Abstract base class for all Excel datavalidations. Contains functionlity which is common for all these different validation types.
Inheritance
Implements
Inherited Members
Namespace: OfficeOpenXml.DataValidation
Assembly: EPPlus.dll
Syntax
public abstract class ExcelDataValidation : XmlHelper, IExcelDataValidation
Properties
Address
Address of data validation
Declaration
public ExcelAddress Address { get; }
Property Value
Type | Description |
---|---|
ExcelAddress |
AllowBlank
True if blanks should be allowed
Declaration
public bool? AllowBlank { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
AllowsOperator
True if the validation type allows operator to be set.
Declaration
public bool AllowsOperator { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
As
Us this property to case IExcelDataValidations to its subtypes
Declaration
public ExcelDataValidationAsType As { get; }
Property Value
Type | Description |
---|---|
ExcelDataValidationAsType |
Error
Error message box text
Declaration
public string Error { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ErrorStyle
Warning style
Declaration
public ExcelDataValidationWarningStyle ErrorStyle { get; set; }
Property Value
Type | Description |
---|---|
ExcelDataValidationWarningStyle |
ErrorTitle
Title of error message box
Declaration
public string ErrorTitle { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Formula1Internal
Formula 1
Declaration
protected string Formula1Internal { get; }
Property Value
Type | Description |
---|---|
System.String |
Formula2Internal
Formula 2
Declaration
protected string Formula2Internal { get; }
Property Value
Type | Description |
---|---|
System.String |
Operator
Operator for comparison between the entered value and Formula/Formulas.
Declaration
public ExcelDataValidationOperator Operator { get; set; }
Property Value
Type | Description |
---|---|
ExcelDataValidationOperator |
Prompt
Text of the validation message box.
Declaration
public string Prompt { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PromptTitle
Title of the validation message box.
Declaration
public string PromptTitle { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ShowErrorMessage
True if error message should be shown
Declaration
public bool? ShowErrorMessage { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
ShowInputMessage
True if input message should be shown
Declaration
public bool? ShowInputMessage { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
Uid
Declaration
public string Uid { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ValidationType
Validation type
Declaration
public ExcelDataValidationType ValidationType { get; }
Property Value
Type | Description |
---|---|
ExcelDataValidationType |
Methods
GetFormula1Path()
Declaration
protected string GetFormula1Path()
Returns
Type | Description |
---|---|
System.String |
GetFormula2Path()
Declaration
protected string GetFormula2Path()
Returns
Type | Description |
---|---|
System.String |
SetValue<T>(Nullable<T>, String)
Sets the value to the supplied path
Declaration
protected void SetValue<T>(T? val, string path)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<T> | val | The value to set |
System.String | path | xml path |
Type Parameters
Name | Description |
---|---|
T |
Validate()
This method will validate the state of the validation
Declaration
public virtual void Validate()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If the state breaks the rules of the validation |