Hi, I'm importing excel files with extension xls and xlsx but my doubt is how to detect if the column of a cell is visible or hidden, thank you in advance for your response.
Hi, I'm importing excel files with extension xls and xlsx but my doubt is how to detect if the column of a cell is visible or hidden, thank you in advance for your response.
I solved it like this:
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
InputStream excelStream = new FileInputStream(new File("/path/to/file"));
Workbook workbook = new HSSFWorkbook(excelStream);
Sheet sheet = hssfWorkbook.getSheetAt(0);
Row row = null;
Cell celda = null;
int rowIndex = 0;
rowIterator = sheet.iterator();
for (rowIndex = 0; rowIterator.hasNext();) {
row = rowIterator.next();
celda = row.getCell(celIndex);
if (sheet.isColumnHidden(celda.getColumnIndex())) {
// COLUMNA OCULTA
} else {
// COLUMNA VISIBLE
}
}