Package org.apache.poi.hssf.usermodel
Class HSSFDataValidation
java.lang.Object
org.apache.poi.hssf.usermodel.HSSFDataValidation
- All Implemented Interfaces:
DataValidation
Utility class for creating data validation cells
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.DataValidation
DataValidation.ErrorStyle -
Constructor Summary
ConstructorsConstructorDescriptionHSSFDataValidation(CellRangeAddressList regions, DataValidationConstraint constraint) Constructor which initializes the cell range on which this object will be applied -
Method Summary
Modifier and TypeMethodDescriptioncreateDVRecord(HSSFSheet sheet) voidcreateErrorBox(String title, String text) Sets the title and text for the error box .voidcreatePromptBox(String title, String text) Sets the title and text for the prompt box .booleanRetrieve the settings for empty cells allowedintobooleanbooleanbooleanUseful only list validation objects .voidsetEmptyCellAllowed(boolean allowed) Sets if this object allows empty as a valid valuevoidsetErrorStyle(int error_style) Sets the error style for error boxvoidsetShowErrorBox(boolean show) Sets the behaviour when an invalid value is enteredvoidsetShowPromptBox(boolean show) Sets the behaviour when a cell which belongs to this object is selectedvoidsetSuppressDropDownArrow(boolean suppress) Useful for list validation objects .
-
Constructor Details
-
HSSFDataValidation
Constructor which initializes the cell range on which this object will be applied- Parameters:
regions- A list of regions where the constraint is validated.constraint- The constraints to apply for this validation.
-
-
Method Details
-
getValidationConstraint
- Specified by:
getValidationConstraintin interfaceDataValidation
-
getConstraint
-
getRegions
- Specified by:
getRegionsin interfaceDataValidation
-
setErrorStyle
public void setErrorStyle(int error_style) Description copied from interface:DataValidationSets the error style for error box- Specified by:
setErrorStylein interfaceDataValidation- See Also:
-
getErrorStyle
public int getErrorStyle()Description copied from interface:DataValidationo- Specified by:
getErrorStylein interfaceDataValidation- Returns:
- the error style of error box
- See Also:
-
setEmptyCellAllowed
public void setEmptyCellAllowed(boolean allowed) Description copied from interface:DataValidationSets if this object allows empty as a valid value- Specified by:
setEmptyCellAllowedin interfaceDataValidation- Parameters:
allowed-trueif this object should treats empty as valid value ,falseotherwise
-
getEmptyCellAllowed
public boolean getEmptyCellAllowed()Description copied from interface:DataValidationRetrieve the settings for empty cells allowed- Specified by:
getEmptyCellAllowedin interfaceDataValidation- Returns:
- True if this object should treats empty as valid value , false otherwise
-
setSuppressDropDownArrow
public void setSuppressDropDownArrow(boolean suppress) Description copied from interface:DataValidationUseful for list validation objects .- Specified by:
setSuppressDropDownArrowin interfaceDataValidation- Parameters:
suppress- True if a list should display the values into a drop down list , false otherwise . In other words , if a list should display the arrow sign on its right side
-
getSuppressDropDownArrow
public boolean getSuppressDropDownArrow()Description copied from interface:DataValidationUseful only list validation objects . This method always returns false if the object isn't a list validation object- Specified by:
getSuppressDropDownArrowin interfaceDataValidation- Returns:
trueif a list should display the values into a drop down list ,falseotherwise .
-
setShowPromptBox
public void setShowPromptBox(boolean show) Description copied from interface:DataValidationSets the behaviour when a cell which belongs to this object is selected- Specified by:
setShowPromptBoxin interfaceDataValidation- Parameters:
show-trueif an prompt box should be displayed ,falseotherwise
-
getShowPromptBox
public boolean getShowPromptBox()- Specified by:
getShowPromptBoxin interfaceDataValidation- Returns:
trueif an prompt box should be displayed ,falseotherwise
-
setShowErrorBox
public void setShowErrorBox(boolean show) Description copied from interface:DataValidationSets the behaviour when an invalid value is entered- Specified by:
setShowErrorBoxin interfaceDataValidation- Parameters:
show-trueif an error box should be displayed ,falseotherwise
-
getShowErrorBox
public boolean getShowErrorBox()- Specified by:
getShowErrorBoxin interfaceDataValidation- Returns:
trueif an error box should be displayed ,falseotherwise
-
createPromptBox
Description copied from interface:DataValidationSets the title and text for the prompt box . Prompt box is displayed when the user selects a cell which belongs to this validation object . In order for a prompt box to be displayed you should also use method setShowPromptBox( boolean show )- Specified by:
createPromptBoxin interfaceDataValidation- Parameters:
title- The prompt box's titletext- The prompt box's text
-
getPromptBoxTitle
- Specified by:
getPromptBoxTitlein interfaceDataValidation- Returns:
- Prompt box's title or
null
-
getPromptBoxText
- Specified by:
getPromptBoxTextin interfaceDataValidation- Returns:
- Prompt box's text or
null
-
createErrorBox
Description copied from interface:DataValidationSets the title and text for the error box . Error box is displayed when the user enters an invalid value int o a cell which belongs to this validation object . In order for an error box to be displayed you should also use method setShowErrorBox( boolean show )- Specified by:
createErrorBoxin interfaceDataValidation- Parameters:
title- The error box's titletext- The error box's text
-
getErrorBoxTitle
- Specified by:
getErrorBoxTitlein interfaceDataValidation- Returns:
- Error box's title or
null
-
getErrorBoxText
- Specified by:
getErrorBoxTextin interfaceDataValidation- Returns:
- Error box's text or
null
-
createDVRecord
-