Resolution with the Apache POI.
The combobox will be read in the same way as a normal cell. The only detail is in the checkbox reading. This field is a Boolean, configuring it will indicate which cell will receive true / false. You should get the value you want from this cell. In my case, I configured the checkbox as follows:
Thismeansthatregardlessofwherethecheckboxis,whenmarkingoruncheckingit,thevalueofthecheckbox(true/false)willbestoredincellC7.
Excelexample:
Codesample:
publicstaticvoidmain(Stringargs[])throwsIOException{try(InputStreaminputStream=ReadExcelControls.class.getResourceAsStream("readControls.xls");
HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
) {
Sheet sheet = workbook.getSheet("teste");
Cell nomeComum = sheet.getRow(0).getCell(1);
Cell classificacaoEspecie = sheet.getRow(2).getCell(1);
Cell envenenamento = sheet.getRow(6).getCell(2);
//Campo normal
System.out.println("Nome Comum: " + nomeComum.getStringCellValue());
//Combobox
System.out.println("Classificação Espécie: " + classificacaoEspecie.getStringCellValue());
//Checkbox
System.out.println("Evenenamento: " + envenenamento.getBooleanCellValue());
}
}