Example:
$workbook = new cells\Workbook(); $validations = $workbook->getWorksheets()->get(0)->getValidations(); $validation = $validations->get($validations->add()); $validation->setType(cells\ValidationType::WHOLE_NUMBER); $validation->setOperator(cells\OperatorType::BETWEEN); $validation->setFormula1("3"); $validation->setFormula2("1234"); $area = new cells\CellArea(); $area->StartRow = 0; $area->EndRow = 1; $area->StartColumn = 0; $area->EndColumn = 1; $validation->addArea($area);
Property Getters/Setters Summary | ||
---|---|---|
function | getAlertStyle() | |
function | setAlertStyle(value) | |
Represents the validation alert style. The value of the property is ValidationAlertType integer constant. | ||
function | getAreas() | |
Gets all |
||
function | getErrorMessage() | |
function | setErrorMessage(value) | |
Represents the data validation error message. | ||
function | getErrorTitle() | |
function | setErrorTitle(value) | |
Represents the title of the data-validation error dialog box. | ||
function | getFormula1() | |
function | setFormula1(value) | |
Represents the value or expression associated with the data validation. | ||
function | getFormula2() | |
function | setFormula2(value) | |
Represents the value or expression associated with the data validation. | ||
function | getIgnoreBlank() | |
function | setIgnoreBlank(value) | |
Indicates whether blank values are permitted by the range data validation. | ||
function | getInCellDropDown() | |
function | setInCellDropDown(value) | |
Indicates whether data validation displays a drop-down list that contains acceptable values. | ||
function | getInputMessage() | |
function | setInputMessage(value) | |
Represents the data validation input message. | ||
function | getInputTitle() | |
function | setInputTitle(value) | |
Represents the title of the data-validation input dialog box. | ||
function | getOperator() | |
function | setOperator(value) | |
Represents the operator for the data validation. The value of the property is OperatorType integer constant. | ||
function | getShowError() | |
function | setShowError(value) | |
Indicates whether the data validation error message will be displayed whenever the user enters invalid data. | ||
function | getShowInput() | |
function | setShowInput(value) | |
Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range. | ||
function | getType() | |
function | setType(value) | |
Represents the data validation type. The value of the property is ValidationType integer constant. | ||
function | getValue1() | |
function | setValue1(value) | |
Represents the first value associated with the data validation. | ||
function | getValue2() | |
function | setValue2(value) | |
Represents the second value associated with the data validation. |
Method Summary | ||
---|---|---|
function | addArea(cellArea) | |
Applies the validation to the area.
|
||
function | addArea(cellArea, checkIntersection, checkEdge) | |
Applies the validation to the area.
|
||
function | addAreas(areas, checkIntersection, checkEdge) | |
Applies the validation to given areas.
|
||
function | copy(source, copyOption) | |
Copy validation.
|
||
function | getFormula1(isR1C1, isLocal) | |
Gets the value or expression associated with this validation.
|
||
function | getFormula1(isR1C1, isLocal, row, column) | |
Gets the value or expression associated with this validation for specific cell.
|
||
function | getFormula2(isR1C1, isLocal) | |
Gets the value or expression associated with this validation.
|
||
function | getFormula2(isR1C1, isLocal, row, column) | |
Gets the value or expression associated with this validation for specific cell.
|
||
function | getListValue(row, column) | |
Get the value for list of the validation for the specified cell.
|
||
function | removeACell(row, column) | |
Remove the validation settings in the cell.
|
||
function | removeArea(cellArea) | |
Remove the validation settings in the range.
|
||
function | removeAreas(areas) | |
Removes this validation from given areas.
|
||
function | setFormula1(formula, isR1C1, isLocal) | |
Sets the value or expression associated with this validation.
|
||
function | setFormula2(formula, isR1C1, isLocal) | |
Sets the value or expression associated with this validation.
|
function getOperator() / function setOperator(value)
function getAlertStyle() / function setAlertStyle(value)
function getType() / function setType(value)
function getInputMessage() / function setInputMessage(value)
function getInputTitle() / function setInputTitle(value)
function getErrorMessage() / function setErrorMessage(value)
function getErrorTitle() / function setErrorTitle(value)
function getShowInput() / function setShowInput(value)
function getShowError() / function setShowError(value)
function getIgnoreBlank() / function setIgnoreBlank(value)
function getFormula1() / function setFormula1(value)
function getFormula2() / function setFormula2(value)
function getValue1() / function setValue1(value)
function getValue2() / function setValue2(value)
function getInCellDropDown() / function setInCellDropDown(value)
function getAreas()
function getFormula1(isR1C1, isLocal)
isR1C1: boolean
- Whether the formula needs to be formatted as R1C1.isLocal: boolean
- Whether the formula needs to be formatted by locale.function getFormula2(isR1C1, isLocal)
isR1C1: boolean
- Whether the formula needs to be formatted as R1C1.isLocal: boolean
- Whether the formula needs to be formatted by locale.function getFormula1(isR1C1, isLocal, row, column)
isR1C1: boolean
- Whether the formula needs to be formatted as R1C1.isLocal: boolean
- Whether the formula needs to be formatted by locale.row: Number
- The row index.column: Number
- The column index.function getFormula2(isR1C1, isLocal, row, column)
isR1C1: boolean
- Whether the formula needs to be formatted as R1C1.isLocal: boolean
- Whether the formula needs to be formatted by locale.row: Number
- The row index.column: Number
- The column index.function setFormula1(formula, isR1C1, isLocal)
formula: String
- The value or expression associated with this format condition.isR1C1: boolean
- Whether the formula is R1C1 formula.isLocal: boolean
- Whether the formula is locale formatted.function setFormula2(formula, isR1C1, isLocal)
formula: String
- The value or expression associated with this format condition.isR1C1: boolean
- Whether the formula is R1C1 formula.isLocal: boolean
- Whether the formula is locale formatted.function getListValue(row, column)
row: Number
- The row index.column: Number
- The column index.function addArea(cellArea)
cellArea: CellArea
- The area.function addArea(cellArea, checkIntersection, checkEdge)
cellArea: CellArea
- The area.checkIntersection: boolean
- Whether check the intersection of given area with existing validations' areas.
If one validation has been applied in given area(or part of it),
then the existing validation should be removed at first from given area.
Otherwise corruption may be caused for the generated Validations.
If user is sure that the added area does not intersect with any existing area,
this parameter can be set as false for performance consideration.checkEdge: boolean
- Whether check the edge of this validation's applied areas.
Validation's internal settings depend on the top-left one of its applied ranges,
so if given area will become the new top-left one of the applied ranges,
the internal settings should be changed and rebuilt, otherwise unexpected result may be caused.
If user is sure that the added area is not the top-left one,
this parameter can be set as false for performance consideration.function addAreas(areas, checkIntersection, checkEdge)
areas: CellArea[]
- The areas.checkIntersection: boolean
- Whether check the intersection of given area with existing validations' areas.
If one validation has been applied in given area(or part of it),
then the existing validation should be removed at first from given area.
Otherwise corruption may be caused for the generated Validations.
If user is sure that all the added areas do not intersect with any existing area,
this parameter can be set as false for performance consideration.checkEdge: boolean
- Whether check the edge of this validation's applied areas.
Validation's internal settings depend on the top-left one of its applied ranges,
so if one of given areas will become the new top-left one of the applied ranges,
the internal settings should be changed and rebuilt, otherwise unexpected result may be caused.
If user is sure that no one of those added areas is the top-left,
this parameter can be set as false for performance consideration.function removeArea(cellArea)
cellArea: CellArea
- the areas where this validation settings should be removed.function removeAreas(areas)
areas: CellArea[]
- the areas where this validation settings should be removed.function removeACell(row, column)
row: Number
- The row index.column: Number
- The column index.function copy(source, copyOption)
source: Validation
- The source validation.copyOption: CopyOptions
- The copy option.