1
Resolution with Apache POI.
The reading of the combobox will be done in the same way as a normal cell. The only detail is the reading of the checkbox. This field is a boolean, when configuring it you will indicate which cell will receive true/false. You should take the value you want from that cell. In my case, I set up the checkbox as follows:
This means that regardless of where the checkbox is, when you mark or uncheck it, the checkbox value (true/false) will be stored in cell C7.
Excel example:
Code example:
public static void main(String args[]) throws IOException {
try (
InputStream inputStream = 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());
}
}