DataValidations

DataValidations

A class stores dataValidations.

Constructor

new DataValidations(sheet, dataValidationsNode, extNode)

Source:
Parameters:
Name Type Description
sheet Sheet

The sheet.

dataValidationsNode Object

The dataValidation node.

extNode Object

The extension data validation node.

Methods

delete(refString) → {undefined}

Source:

Remove a dataValidation.

Parameters:
Name Type Description
refString string

The reference you want to remove.

Returns:
Type
undefined

get(refString) → {Object|undefined}

Source:

Retrieve a dataValidation node.

Parameters:
Name Type Description
refString string

The reference string to parse.

Returns:

A dataValidation node.

Type
Object | undefined

getDataValidation(address, parseFormulaopt) → {undefined|Object}

Source:

Get a data validation on the given address.

Parameters:
Name Type Attributes Default Description
address string

The address of a cell or range.

parseFormula boolean <optional>
true

Whether parsing the formulas. If true, the returned object contains formula1Result amd formula2Result.

Returns:
  • The data validation object.
Type
undefined | Object

parse(address) → {Object}

Source:

Parse a reference, i.e. D19, A1:C9, Sheet2!A1, A:C, 1:6...

Parameters:
Name Type Description
address string

The reference string to parse.

Returns:

The reference object.

Type
Object

parseFormula(formula) → {*}

Source:

Parse a formula.

Parameters:
Name Type Description
formula string | number

The formula to parse.

Returns:

The formula result

Type
*

set(refString, dataValidation) → {undefined}

Source:

Add dataValidation. If exists, replace it.

Parameters:
Name Type Description
refString string

The reference string to add.

dataValidation Object

The inner dataValidation node.

Returns:
Type
undefined

setDataValidation(address, dataValidation) → {undefined}

Source:

Set a data validation on the given address.

Parameters:
Name Type Description
address string

The address of a cell or range.

dataValidation undefined | Object

The data validation object.

Returns:
Type
undefined

toXml() → {Object}

Source:

Return an xml form object.

Returns:

two Xml object.

Type
Object

validate(cell, input, isFormulaopt) → {Object}

Source:

Validate a input.

Example
validate(cell, '1+1', true)
     validate(cell, '111')
Parameters:
Name Type Attributes Description
cell Cell

The cell to validate.

input string | boolean | number | undefined | null

The input to validate.

isFormula boolean <optional>

If true, the input is a formula.

Returns:

An object that contains Whether the input is valid.

Type
Object