com.aspose.cells
Class Validation

java.lang.Object
    extended by com.aspose.cells.Validation

public class Validation 
extends java.lang.Object

Represents data validation.settings.

Example:

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

CellArea area = new CellArea();
area.StartRow = 0;
area.EndRow = 1;
area.StartColumn = 0;
area.EndColumn = 1;

validation.getAreaList().add(area);

Property Getters/Setters Summary
intgetAlertStyle()
voidsetAlertStyle(int value)
           Represents the validation alert style. The value of the property is ValidationAlertType integer constant.
java.util.ArrayListgetAreaList()
           Represents a collection of CellArea which contains the data validation settings.
CellArea[]getAreas()
           Gets all CellArea which contain the data validation settings.
java.lang.StringgetErrorMessage()
voidsetErrorMessage(java.lang.String value)
           Represents the data validation error message.
java.lang.StringgetErrorTitle()
voidsetErrorTitle(java.lang.String value)
           Represents the title of the data-validation error dialog box.
java.lang.StringgetFormula1()
voidsetFormula1(java.lang.String value)
           Represents the value or expression associated with the data validation.
java.lang.StringgetFormula2()
voidsetFormula2(java.lang.String value)
           Represents the value or expression associated with the data validation.
booleangetIgnoreBlank()
voidsetIgnoreBlank(boolean value)
           Indicates whether blank values are permitted by the range data validation.
booleangetInCellDropDown()
voidsetInCellDropDown(boolean value)
           Indicates whether data validation displays a drop-down list that contains acceptable values.
java.lang.StringgetInputMessage()
voidsetInputMessage(java.lang.String value)
           Represents the data validation input message.
java.lang.StringgetInputTitle()
voidsetInputTitle(java.lang.String value)
           Represents the title of the data-validation input dialog box.
intgetOperator()
voidsetOperator(int value)
           Represents the operator for the data validation. The value of the property is OperatorType integer constant.
booleangetShowError()
voidsetShowError(boolean value)
           Indicates whether the data validation error message will be displayed whenever the user enters invalid data.
booleangetShowInput()
voidsetShowInput(boolean value)
           Indicates whether the data validation input message will be displayed whenever the user selects a cell in the data validation range.
intgetType()
voidsetType(int value)
           Represents the data validation type. The value of the property is ValidationType integer constant.
java.lang.ObjectgetValue1()
voidsetValue1(java.lang.Object value)
           Represents the first value associated with the data validation.
java.lang.ObjectgetValue2()
voidsetValue2(java.lang.Object value)
           Represents the first value associated with the data validation.
 
Method Summary
voidaddArea(CellArea cellArea)
           Applies the validation to the area.
java.lang.StringgetFormula1(boolean isR1C1, boolean isLocal)
           Gets the value or expression associated with this validation.
java.lang.StringgetFormula1(boolean isR1C1, boolean isLocal, int row, int column)
           Gets the value or expression associated with this validation.
java.lang.StringgetFormula2(boolean isR1C1, boolean isLocal)
           Gets the value or expression associated with this validation.
java.lang.StringgetFormula2(boolean isR1C1, boolean isLocal, int row, int column)
           Gets the value or expression associated with this validation.
voidremoveACell(int row, int column)
           Remove the validation settings in the cell.
voidremoveArea(CellArea cellArea)
           Remove the validation settings in the range.
voidsetFormula1(java.lang.String formula, boolean isR1C1, boolean isLocal)
           Sets the value or expression associated with this validation.
voidsetFormula2(java.lang.String formula, boolean isR1C1, boolean isLocal)
           Sets the value or expression associated with this validation.
 

Property Getters/Setters Detail

getOperator/setOperator

public int getOperator() / public void setOperator(int value)
Represents the operator for the data validation. The value of the property is OperatorType integer constant.

getAlertStyle/setAlertStyle

public int getAlertStyle() / public void setAlertStyle(int value)
Represents the validation alert style. The value of the property is ValidationAlertType integer constant.

getType/setType

public int getType() / public void setType(int value)
Represents the data validation type. The value of the property is ValidationType integer constant.

getInputMessage/setInputMessage

public java.lang.String getInputMessage() / public void setInputMessage(java.lang.String value)
Represents the data validation input message.

getInputTitle/setInputTitle

public java.lang.String getInputTitle() / public void setInputTitle(java.lang.String value)
Represents the title of the data-validation input dialog box.

getErrorMessage/setErrorMessage

public java.lang.String getErrorMessage() / public void setErrorMessage(java.lang.String value)
Represents the data validation error message.

getErrorTitle/setErrorTitle

public java.lang.String getErrorTitle() / public void setErrorTitle(java.lang.String value)
Represents the title of the data-validation error dialog box.

getShowInput/setShowInput

public boolean getShowInput() / 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.

getShowError/setShowError

public boolean getShowError() / public void setShowError(boolean value)
Indicates whether the data validation error message will be displayed whenever the user enters invalid data.

getIgnoreBlank/setIgnoreBlank

public boolean getIgnoreBlank() / public void setIgnoreBlank(boolean value)
Indicates whether blank values are permitted by the range data validation.

getFormula1/setFormula1

public java.lang.String getFormula1() / public void setFormula1(java.lang.String value)
Represents the value or expression associated with the data validation.

getFormula2/setFormula2

public java.lang.String getFormula2() / public void setFormula2(java.lang.String value)
Represents the value or expression associated with the data validation.

getValue1/setValue1

public java.lang.Object getValue1() / public void setValue1(java.lang.Object value)
Represents the first value associated with the data validation.

getValue2/setValue2

public java.lang.Object getValue2() / public void setValue2(java.lang.Object value)
Represents the first value associated with the data validation.

getInCellDropDown/setInCellDropDown

public boolean getInCellDropDown() / public void setInCellDropDown(boolean value)
Indicates whether data validation displays a drop-down list that contains acceptable values.

getAreaList

public java.util.ArrayList getAreaList()
Represents a collection of CellArea which contains the data validation settings. The old validations on the area will not be removed if directly adding are to this list. NOTE: This member is now obsolete. Instead, please use ValidationCollection.Add(CellArea) method. This property will be removed 12 months later since JUNE 2017. Aspose apologizes for any inconvenience you may have experienced.

getAreas

public CellArea[] getAreas()
Gets all CellArea which contain the data validation settings.

Method Detail

getFormula1

public java.lang.String getFormula1(boolean isR1C1, boolean isLocal)
Gets the value or expression associated with this validation.
Parameters:
isR1C1 - Whether the formula needs to be formatted as R1C1.
isLocal - Whether the formula needs to be formatted by locale.
Returns:
The value or expression associated with this validation.

getFormula2

public java.lang.String getFormula2(boolean isR1C1, boolean isLocal)
Gets the value or expression associated with this validation.
Parameters:
isR1C1 - Whether the formula needs to be formatted as R1C1.
isLocal - Whether the formula needs to be formatted by locale.
Returns:
The value or expression associated with this validation.

getFormula1

public java.lang.String getFormula1(boolean isR1C1, boolean isLocal, int row, int column)
Gets the value or expression associated with this validation.
Parameters:
isR1C1 - Whether the formula needs to be formatted as R1C1.
isLocal - Whether the formula needs to be formatted by locale.
row - The row index.
column - The column index.
Returns:
The value or expression associated with this validation.

getFormula2

public java.lang.String getFormula2(boolean isR1C1, boolean isLocal, int row, int column)
Gets the value or expression associated with this validation.
Parameters:
isR1C1 - Whether the formula needs to be formatted as R1C1.
isLocal - Whether the formula needs to be formatted by locale.
row - The row index.
column - The column index.
Returns:
The value or expression associated with this validation.

setFormula1

public void setFormula1(java.lang.String formula, boolean isR1C1, boolean isLocal)
Sets the value or expression associated with this validation.
Parameters:
formula - The value or expression associated with this format condition.
isR1C1 - Whether the formula is R1C1 formula.
isLocal - Whether the formula is locale formatted.

setFormula2

public void setFormula2(java.lang.String formula, boolean isR1C1, boolean isLocal)
Sets the value or expression associated with this validation.
Parameters:
formula - The value or expression associated with this format condition.
isR1C1 - Whether the formula is R1C1 formula.
isLocal - Whether the formula is locale formatted.

addArea

public void addArea(CellArea cellArea)
Applies the validation to the area. In this method , we will remove all old validations on this area.
Parameters:
cellArea - The area.

removeArea

public void removeArea(CellArea cellArea)
Remove the validation settings in the range.
Parameters:
cellArea - The range which contains the data validation settings.

removeACell

public void removeACell(int row, int column)
Remove the validation settings in the cell.
Parameters:
row - The row index.
column - The column index.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.