0

Why it doesn't work? I use setFillForegroundColor and it clears the cell, rather than to fill it with a color(lime) .

//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 {}
                        }
                                                                 }
                                                                             }
Eldar
  • 153
  • 5
  • 13
  • answer here: http://stackoverflow.com/questions/17243529/cant-set-fill-color-apache-poi-excel-workbook/17247363#17247363 – Eldar Aug 13 '13 at 10:27
  • Try `style.setFillForegroundColor(IndexedColors.LIME.getIndex());` just before `row.createCell(2+j).setCellStyle(style);` – Sankumarsingh Aug 27 '13 at 07:30

0 Answers0