为什么它不起作用?我使用setFillForegroundColor
并清除单元格,而不是用颜色(石灰)填充它。
//Get the workbook instance for XLS file
HSSFWorkbook workbook = new HSSFWorkbook(file);
CreationHelper createHelper = workbook.getCreationHelper();
//Get first sheet from the workbook
HSSFSheet sheet = workbook.getSheetAt(0);
CellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(IndexedColors.LIME.getIndex());
......
label1:
for (int i=0;i<ListOfList.size();i++) {
Row row = sheet.getRow(i);
for (int j=0;j<ListOfList.get(i).size();j++) {
for (int k=0;k<List.size();k++){
if (List.get(k).equals(ListOfList.get(i).get(j)) | ListOfList.get(i).get(j).contains(List.get(k))) {
System.out.println("("+List.get(k)+") ASU <--> ("+ListOfList.get(i).get(j)+") RZS "+"Строчка: "+i+" Столбец: "+j);
row.createCell(2+j).setCellStyle(style);
}
else {}
}
}
}