Created attachment 27567 [details] Patch. I need to detect whether a given HSSFSheet already has DataValidation settings applied. The DataValidityTable class already has a visitContainedRecords(RecordVisitor) method, that is currently inaccessible from both HSSFSheet and user code. The following patch suggests to add a method public void visitValidationData(RecordVisitor rv) to HSSFSheet to iterate through the DataValidation records. Use it like this: final RecordVisitor rv = new RecordVisitor() { @Override public void visitRecord(Record r) { if (r instanceof DVRecord){ final DVRecord dr = (DVRecord) r; // So there's the validation if (dr.getDataType() == ValidationType.LIST){ // There is a DROP DOWN list! Use dr.* to examine location and content. } } } }; sheet.visitValidationData(rv); The XSSFSheet already provides a getDataValidations() method,
Unfortunately the path in its current form cannot be applied. HSSF does not expose classes for internal use: there are no getters that return record.* or model.* objects, these are hidden and it is by design. Think about implementing getDataValidations() in HSSFSheet. That would be cool and this method will go to the interface: In the Sheet interface we will have List<DataValidation> getDataValidations() and two implementations: List<HSSHDataValidation> getDataValidations() List<XSSFDataValidation> getDataValidations() Regards, Yegor
This method is available since some time already, therefore resolving this as FIXED.