【发布时间】:2017-05-31 17:47:37
【问题描述】:
我正在查看每一行的第 1 列的值是否相同或不同我尝试将 .getContents() 添加到单元格和工作表的末尾,但它不会改变结果并尝试转换它们都是字符串,但结果仍然相同。每次我尝试它都会返回“do action 2”
我也在使用 JExcelAPI
w = Workbook.getWorkbook(inputWorkbook);
Sheet sheet = w.getSheet(0);
for(int i = 1;i<sheet.getRows(); i++){
Cell cell = sheet.getCell(0,i);
if(cell == sheet.getCell(0, (i+1))){ //If cell is the same value as the one in the row below it
//do action 1
}
else if(cell != sheet.getCell(0,(i+1))){//If cell has a different value as the one in the row below it
//do action 2
}
}
【问题讨论】: