我有这个excel表,它在其中读取特定的列,现在读取后应该对其进行检查,如果它具有值,则应在其下一行放置另一个值。例如 在D列(第1行,单元3)上具有值,因此应在F列上写“具有年龄”(在第1行,单元5)上或应该写入的内容。等等,直到D列的其余部分结束,并且它也应该在F列中
Workbook workbook = WorkbookFactory.create(inputStream);
Sheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(0);// pababa SPECIFY SAAN ILALAGAY
// Specific cell number
Cell cell = row.getCell(0);
for (int i = 0; i < 10; i++) {
row = sheet.getRow(i);
if (row != null) {
cell.setCellValue("qwe");
}
}
for (int i = 0; i < 10; i++) {
row = sheet.createRow(i);
cell = row.createCell(2);
cell.setCellValue(100);
}
} else {
System.out.println("nasa else to");
}
/* XSSFCell exceltaym = (XSSFCell) row.getCell(0); //nag convert nang time to integer na na compute till line 177[enter image description here][1]
if (exceltaym == null) {
cell.setCellValue(9);
}else
{
System.out.println("this statement is on else code ");
}
答案 0 :(得分:0)
我不确定我是否理解,但是您不能只在F列中使用此公式来检查D列是否为空吗?
=IF(D1<>"", "has age")