Validation

Inheritance: java.lang.Object

public class Validation

Represents data validation.settings.

Example

         Workbook workbook = new Workbook();
         	ValidationCollection validations = workbook.getWorksheets().get(0).getValidations();
         	CellArea area = CellArea.createCellArea(0, 0, 1, 1);
         	Validation validation = validations.get(validations.add(area));
         	validation.setType(com.aspose.cells.ValidationType.WHOLE_NUMBER);
         	validation.setOperator(OperatorType.BETWEEN);
         	validation.setFormula1("3");
         	validation.setFormula2("1234");

Methods

MethodDescription
addArea(CellArea cellArea)Applies the validation to the area.
addArea(CellArea cellArea, boolean checkIntersection, boolean checkEdge)Applies the validation to the area.
addAreas(CellArea[] areas, boolean checkIntersection, boolean checkEdge)Applies the validation to given areas.
copy(Validation source, CopyOptions copyOption)Copy validation.
equals(Object arg0)
getAlertStyle()Represents the validation alert style.
getAreas()Gets all CellArea which contain the data validation settings.
getClass()
getErrorMessage()Represents the data validation error message.
getErrorTitle()Represents the title of the data-validation error dialog box.
getFormula1()Represents the value or expression associated with the data validation.
getFormula1(boolean isR1C1, boolean isLocal)Gets the value or expression associated with this validation.
getFormula1(boolean isR1C1, boolean isLocal, int row, int column)Gets the value or expression associated with this validation for specific cell.
getFormula2()Represents the value or expression associated with the data validation.
getFormula2(boolean isR1C1, boolean isLocal)Gets the value or expression associated with this validation.
getFormula2(boolean isR1C1, boolean isLocal, int row, int column)Gets the value or expression associated with this validation for specific cell.
getIgnoreBlank()Indicates whether blank values are permitted by the range data validation.
getInCellDropDown()Indicates whether data validation displays a drop-down list that contains acceptable values.
getInputMessage()Represents the data validation input message.
getInputTitle()Represents the title of the data-validation input dialog box.
getListValue(int row, int column)Get the value for list of the validation for the specified cell.
getOperator()Represents the operator for the data validation.
getShowError()Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
getShowInput()Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
getType()Represents the data validation type.
getValue(int row, int column, boolean isValue1)Get the value of validation on the specific cell.
getValue1()Represents the first value associated with the data validation.
getValue2()Represents the second value associated with the data validation.
hashCode()
notify()
notifyAll()
removeACell(int row, int column)Remove the validation settings in the cell.
removeArea(CellArea cellArea)Remove the validation settings in the range.
removeAreas(CellArea[] areas)Removes this validation from given areas.
setAlertStyle(int value)Represents the validation alert style.
setErrorMessage(String value)Represents the data validation error message.
setErrorTitle(String value)Represents the title of the data-validation error dialog box.
setFormula1(String value)Represents the value or expression associated with the data validation.
setFormula1(String formula, boolean isR1C1, boolean isLocal)Sets the value or expression associated with this validation.
setFormula2(String value)Represents the value or expression associated with the data validation.
setFormula2(String formula, boolean isR1C1, boolean isLocal)Sets the value or expression associated with this validation.
setIgnoreBlank(boolean value)Indicates whether blank values are permitted by the range data validation.
setInCellDropDown(boolean value)Indicates whether data validation displays a drop-down list that contains acceptable values.
setInputMessage(String value)Represents the data validation input message.
setInputTitle(String value)Represents the title of the data-validation input dialog box.
setOperator(int value)Represents the operator for the data validation.
setShowError(boolean value)Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
setShowInput(boolean value)Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
setType(int value)Represents the data validation type.
setValue1(Object value)Represents the first value associated with the data validation.
setValue2(Object value)Represents the second value associated with the data validation.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

addArea(CellArea cellArea)

public void addArea(CellArea cellArea)

Applies the validation to the area.

Remarks

It is equivalent to use addArea(CellArea,boolean,boolean) with checking intersection and edge.

Parameters:

ParameterTypeDescription
cellAreaCellAreaThe area.

addArea(CellArea cellArea, boolean checkIntersection, boolean checkEdge)

public void addArea(CellArea cellArea, boolean checkIntersection, boolean checkEdge)

Applies the validation to the area.

Remarks

In this method, we will remove all old validations in given area. For the top-left one of Validation’s applied ranges, firstly its StartRow is smallest, secondly its StartColumn is the smallest one of those areas who have the same smallest StartRow.

Parameters:

ParameterTypeDescription
cellAreaCellAreaThe area.
checkIntersectionbooleanWhether 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.
checkEdgebooleanWhether 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.

addAreas(CellArea[] areas, boolean checkIntersection, boolean checkEdge)

public void addAreas(CellArea[] areas, boolean checkIntersection, boolean checkEdge)

Applies the validation to given areas.

Remarks

In this method, we will remove all old validations in given area. For the top-left one of Validation’s applied ranges, firstly its StartRow is smallest, secondly its StartColumn is the smallest one of those areas who have the same smallest StartRow.

Parameters:

ParameterTypeDescription
areasCellArea[]The areas.
checkIntersectionbooleanWhether 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.
checkEdgebooleanWhether 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.

copy(Validation source, CopyOptions copyOption)

public void copy(Validation source, CopyOptions copyOption)

Copy validation.

Parameters:

ParameterTypeDescription
sourceValidationThe source validation.
copyOptionCopyOptionsThe copy option.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getAlertStyle()

public int getAlertStyle()

Represents the validation alert style.

See ValidationAlertType.

Returns: int

getAreas()

public CellArea[] getAreas()

Gets all CellArea which contain the data validation settings.

Returns: com.aspose.cells.CellArea[]

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getErrorMessage()

public String getErrorMessage()

Represents the data validation error message.

Returns: java.lang.String

getErrorTitle()

public String getErrorTitle()

Represents the title of the data-validation error dialog box.

Returns: java.lang.String

getFormula1()

public String getFormula1()

Represents the value or expression associated with the data validation.

Returns: java.lang.String

getFormula1(boolean isR1C1, boolean isLocal)

public String getFormula1(boolean isR1C1, boolean isLocal)

Gets the value or expression associated with this validation.

Parameters:

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: java.lang.String - The value or expression associated with this validation.

getFormula1(boolean isR1C1, boolean isLocal, int row, int column)

public String getFormula1(boolean isR1C1, boolean isLocal, int row, int column)

Gets the value or expression associated with this validation for specific cell.

Parameters:

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.
rowintThe row index.
columnintThe column index.

Returns: java.lang.String - The value or expression associated with this validation.

getFormula2()

public String getFormula2()

Represents the value or expression associated with the data validation.

Returns: java.lang.String

getFormula2(boolean isR1C1, boolean isLocal)

public String getFormula2(boolean isR1C1, boolean isLocal)

Gets the value or expression associated with this validation.

Parameters:

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: java.lang.String - The value or expression associated with this validation.

getFormula2(boolean isR1C1, boolean isLocal, int row, int column)

public String getFormula2(boolean isR1C1, boolean isLocal, int row, int column)

Gets the value or expression associated with this validation for specific cell.

Parameters:

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.
rowintThe row index.
columnintThe column index.

Returns: java.lang.String - The value or expression associated with this validation.

getIgnoreBlank()

public boolean getIgnoreBlank()

Indicates whether blank values are permitted by the range data validation.

Returns: boolean

getInCellDropDown()

public boolean getInCellDropDown()

Indicates whether data validation displays a drop-down list that contains acceptable values.

Returns: boolean

getInputMessage()

public String getInputMessage()

Represents the data validation input message.

Returns: java.lang.String

getInputTitle()

public String getInputTitle()

Represents the title of the data-validation input dialog box.

Returns: java.lang.String

getListValue(int row, int column)

public Object getListValue(int row, int column)

Get the value for list of the validation for the specified cell.

Remarks

Only for validation whose type is List and has been applied to given cell, otherwise null will be returned.

Parameters:

ParameterTypeDescription
rowintThe row index.
columnintThe column index.

Returns: java.lang.Object - The value to produce the list of this validation for the specified cell. If the list references to a range, then the returned value will be a ReferredArea object; Otherwise the returned value may be null, object[], or simple object.

getOperator()

public int getOperator()

Represents the operator for the data validation.

See OperatorType.

Returns: int

getShowError()

public boolean getShowError()

Indicates whether the data validation error message will be displayed whenever the user enters invalid data.

Returns: boolean

getShowInput()

public boolean getShowInput()

Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.

Returns: boolean

getType()

public int getType()

Represents the data validation type.

See ValidationType.

Returns: int

getValue(int row, int column, boolean isValue1)

public Object getValue(int row, int column, boolean isValue1)

Get the value of validation on the specific cell.

Parameters:

ParameterTypeDescription
rowintThe row index.
columnintThe column index.
isValue1booleanIndicates whether getting the first value.

Returns: java.lang.Object -

getValue1()

public Object getValue1()

Represents the first value associated with the data validation.

Returns: java.lang.Object

getValue2()

public Object getValue2()

Represents the second value associated with the data validation.

Returns: java.lang.Object

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

removeACell(int row, int column)

public void removeACell(int row, int column)

Remove the validation settings in the cell.

Parameters:

ParameterTypeDescription
rowintThe row index.
columnintThe column index.

removeArea(CellArea cellArea)

public void removeArea(CellArea cellArea)

Remove the validation settings in the range.

Parameters:

ParameterTypeDescription
cellAreaCellAreathe areas where this validation settings should be removed.

removeAreas(CellArea[] areas)

public void removeAreas(CellArea[] areas)

Removes this validation from given areas.

Parameters:

ParameterTypeDescription
areasCellArea[]the areas where this validation settings should be removed.

setAlertStyle(int value)

public void setAlertStyle(int value)

Represents the validation alert style.

See ValidationAlertType.

Parameters:

ParameterTypeDescription
valueint

setErrorMessage(String value)

public void setErrorMessage(String value)

Represents the data validation error message.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setErrorTitle(String value)

public void setErrorTitle(String value)

Represents the title of the data-validation error dialog box.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setFormula1(String value)

public void setFormula1(String value)

Represents the value or expression associated with the data validation.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setFormula1(String formula, boolean isR1C1, boolean isLocal)

public void setFormula1(String formula, boolean isR1C1, boolean isLocal)

Sets the value or expression associated with this validation.

Parameters:

ParameterTypeDescription
formulajava.lang.StringThe value or expression associated with this format condition.
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setFormula2(String value)

public void setFormula2(String value)

Represents the value or expression associated with the data validation.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setFormula2(String formula, boolean isR1C1, boolean isLocal)

public void setFormula2(String formula, boolean isR1C1, boolean isLocal)

Sets the value or expression associated with this validation.

Parameters:

ParameterTypeDescription
formulajava.lang.StringThe value or expression associated with this format condition.
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setIgnoreBlank(boolean value)

public void setIgnoreBlank(boolean value)

Indicates whether blank values are permitted by the range data validation.

Parameters:

ParameterTypeDescription
valueboolean

setInCellDropDown(boolean value)

public void setInCellDropDown(boolean value)

Indicates whether data validation displays a drop-down list that contains acceptable values.

Parameters:

ParameterTypeDescription
valueboolean

setInputMessage(String value)

public void setInputMessage(String value)

Represents the data validation input message.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setInputTitle(String value)

public void setInputTitle(String value)

Represents the title of the data-validation input dialog box.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setOperator(int value)

public void setOperator(int value)

Represents the operator for the data validation.

See OperatorType.

Parameters:

ParameterTypeDescription
valueint

setShowError(boolean value)

public void setShowError(boolean value)

Indicates whether the data validation error message will be displayed whenever the user enters invalid data.

Parameters:

ParameterTypeDescription
valueboolean

setShowInput(boolean value)

public void setShowInput(boolean value)

Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.

Parameters:

ParameterTypeDescription
valueboolean

setType(int value)

public void setType(int value)

Represents the data validation type.

See ValidationType.

Parameters:

ParameterTypeDescription
valueint

setValue1(Object value)

public void setValue1(Object value)

Represents the first value associated with the data validation.

Parameters:

ParameterTypeDescription
valuejava.lang.Object

setValue2(Object value)

public void setValue2(Object value)

Represents the second value associated with the data validation.

Parameters:

ParameterTypeDescription
valuejava.lang.Object

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int