Table of Contents

Class ExcelDataValidation

Namespace
OfficeOpenXml.DataValidation
Assembly
EPPlus.dll

Abstract base class for all Excel datavalidations. Contains functionlity which is common for all these different validation types.

public abstract class ExcelDataValidation : IExcelDataValidation
Inheritance
ExcelDataValidation
Implements
Derived
Inherited Members

Constructors

ExcelDataValidation(ExcelDataValidation, ExcelWorksheet)

Copy-Constructor

protected ExcelDataValidation(ExcelDataValidation validation, ExcelWorksheet ws)

Parameters

validation ExcelDataValidation

Validation to copy from

ws ExcelWorksheet

The worksheet

ExcelDataValidation(string, string, ExcelWorksheet)

Constructor

protected ExcelDataValidation(string uid, string address, ExcelWorksheet ws)

Parameters

uid string

Id for validation

address string

adress validation is applied to

ws ExcelWorksheet

The worksheet

ExcelDataValidation(XmlReader, ExcelWorksheet)

Read-File Constructor

protected ExcelDataValidation(XmlReader xr, ExcelWorksheet ws)

Parameters

xr XmlReader
ws ExcelWorksheet

The worksheet

Properties

Address

Address of data validation

public ExcelAddress Address { get; }

Property Value

ExcelAddress

AllowBlank

True if blanks should be allowed

public bool? AllowBlank { get; set; }

Property Value

bool?

AllowsOperator

True if the current validation type allows operator.

public virtual bool AllowsOperator { get; }

Property Value

bool

As

Us this property to case IExcelDataValidations to its subtypes

public ExcelDataValidationAsType As { get; }

Property Value

ExcelDataValidationAsType

Error

Error message box text

public string Error { get; set; }

Property Value

string

ErrorStyle

Warning style

public ExcelDataValidationWarningStyle ErrorStyle { get; set; }

Property Value

ExcelDataValidationWarningStyle

ErrorTitle

Title of error message box

public string ErrorTitle { get; set; }

Property Value

string

ImeMode

Mode for east-asian languages who use Input Method Editors(IME)

public ExcelDataValidationImeMode ImeMode { get; set; }

Property Value

ExcelDataValidationImeMode

IsStale

Indicates whether this instance is stale, see https://github.com/EPPlusSoftware/EPPlus/wiki/Data-validation-Exceptions DEPRECATED as of Epplus 6.2. This as validations can no longer be stale since all attributes are now always fresh and held in the system.

[Obsolete]
public bool IsStale { get; }

Property Value

bool

OnFormulaChanged

Event method for changing internal type when referring to an external worksheet.

protected Action<OnFormulaChangedEventArgs> OnFormulaChanged { get; }

Property Value

Action<OnFormulaChangedEventArgs>

Operator

Operator for comparison between the entered value and Formula/Formulas.

public ExcelDataValidationOperator Operator { get; set; }

Property Value

ExcelDataValidationOperator

Prompt

Text of the validation message box.

public string Prompt { get; set; }

Property Value

string

PromptTitle

Title of the validation message box.

public string PromptTitle { get; set; }

Property Value

string

ShowErrorMessage

True if error message should be shown

public bool? ShowErrorMessage { get; set; }

Property Value

bool?

ShowInputMessage

True if input message should be shown

public bool? ShowInputMessage { get; set; }

Property Value

bool?

Uid

Uid of the data validation

public string Uid { get; }

Property Value

string

ValidationType

Validation type

public virtual ExcelDataValidationType ValidationType { get; }

Property Value

ExcelDataValidationType

Methods

Validate()

This method will validate the state of the validation

public virtual void Validate()

Exceptions

InvalidOperationException

If the state breaks the rules of the validation