@univerjs/sheets-data-validation v0.5.4


Class: FDataValidation

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:25

Constructors

new FDataValidation()

new FDataValidation(
   rule, 
   worksheet?, 
   _injector?): FDataValidation

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:30

Parameters

ParameterType
ruleIDataValidationRule
worksheet?Worksheet
_injector?Injector

Returns

FDataValidation

Properties

PropertyTypeDefined in
ruleIDataValidationRulesheets-data-validation/src/facade/f-data-validation.ts:26

Methods

copy()

copy(): FDataValidationBuilder

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:73

Creates a new instance of FDataValidationBuilder using the current rule object. This method is useful for copying an existing data validation rule configuration.

Returns

FDataValidationBuilder

A new FDataValidationBuilder instance with the same rule configuration.


delete()

delete(): boolean

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:217

Delete the data validation rule from the worksheet.

Returns

boolean

true if the rule is deleted successfully, false otherwise.


getAllowInvalid()

getAllowInvalid(): boolean

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:40

Gets whether invalid data is allowed based on the error style value.

Returns

boolean

true if invalid data is allowed, false otherwise.


getApplied()

getApplied(): boolean

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:81

Gets whether the data validation rule is applied to the worksheet.

Returns

boolean

true if the rule is applied, false otherwise.


getCriteriaType()

getCriteriaType(): string

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:48

Gets the data validation type of the rule

Returns

string

The data validation type


getCriteriaValues()

getCriteriaValues(): [undefined | string, undefined | string, undefined | string]

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:56

Gets the values used for criteria evaluation

Returns

[undefined | string, undefined | string, undefined | string]

An array containing the operator, formula1, and formula2 values


getHelpText()

getHelpText(): undefined | string

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:64

Gets the help text information, which is used to provide users with guidance and support

Returns

undefined | string

Returns the help text information. If there is no error message, it returns an undefined value.


getRanges()

getRanges(): FRange[]

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:99

Gets the ranges to which the data validation rule is applied.

Returns

FRange[]

An array of IRange objects representing the ranges to which the data validation rule is applied.


getSheetId()

getSheetId(): undefined | string

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:120

Gets the sheetId of the worksheet.

Returns

undefined | string

The sheetId of the worksheet.


getUnitId()

getUnitId(): undefined | string

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:112

Gets the title of the error message dialog box.

Returns

undefined | string

The title of the error message dialog box.


setCriteria()

setCriteria(
   type, 
   values, 
   allowBlank): FDataValidation

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:131

Set Criteria for the data validation rule.

Parameters

ParameterTypeDefault valueDescription
typeDataValidationTypeundefinedThe type of data validation criteria.
values[DataValidationOperator, string, string]undefinedAn array containing the operator, formula1, and formula2 values.
allowBlankbooleantrue-

Returns

FDataValidation

true if the criteria is set successfully, false otherwise.


setOptions()

setOptions(options): FDataValidation

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:167

Set the options for the data validation rule. For details of options, please refer to https://univer.ai/typedoc/@univerjs/core/interfaces/IDataValidationRuleOptions

Parameters

ParameterTypeDescription
optionsPartial<IDataValidationRuleOptions>An object containing the options to set. IDataValidationRuleOptions

Returns

FDataValidation

true if the options are set successfully, false otherwise.


setRanges()

setRanges(ranges): FDataValidation

Defined in: sheets-data-validation/src/facade/f-data-validation.ts:194

Set the ranges to the data validation rule.

Parameters

ParameterTypeDescription
rangesFRange[]new ranges array.

Returns

FDataValidation

true if the ranges are set successfully, false otherwise.