Using Java and Hssf to get Excel data, how to check if a cell is bolded? I am iterating through all sheets, all rows, and all cells of an Excel workbook. I want to perform an action if the cell is bolded.
//Iterate through excel sheets
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
HSSFSheet excelSheet = workbook.getSheetAt(i);
HSSFRow row;
Iterator rows = excelSheet.rowIterator();
//Iterate through rows
while (rows.hasNext()) {
row = (HSSFRow) rows.next();
HSSFCell cell;
Iterator cells = row.cellIterator();
//Iterate through cells
while (cells.hasNext()) {
cell = (HSSFCell) cells.next();
//If cell contains all bolded text
//DO Something
}
}
}