使用Java和Hssf获取Excel数据,如何检查单元格是否加粗?我正在遍历 Excel 工作簿的所有工作表、所有行和所有单元格。如果单元格为粗体,我想执行一个操作。
//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
}
}
}