我使用Apache POI进行单元格格式化(对单元格进行着色)但在20行之后,其他行没有背景色。
这是我的代码:
Cell c = null;
//Cell pleine
CellStyle cs = wb.createCellStyle();
cs.setFillForegroundColor(HSSFColor.LIME.index);
cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
// cs.setFont(font);
//Cell vide
CellStyle csvide = wb.createCellStyle();
csvide.setFillForegroundColor(HSSFColor.WHITE.index);
csvide.setFillPattern(CellStyle.SOLID_FOREGROUND);
HSSFSheet sheet1 = wb.getSheetAt(0);
int rownum = sheet1.getLastRowNum() + 1;
Row row = sheet1.createRow(rownum);
//Row row1 = sheet1.createRow(1);
Num++;
c = row.createCell(0);
c.setCellValue("⇢ " + Num + " " + orderName + " ⇠ ");
c.setCellStyle(cs);
c = row.createCell(1);
c.setCellValue("\uD83D\uDCC5" + NameDate);
c.setCellStyle(cs);
c = row.createCell(2);
c.setCellValue("⏰" + NameHeure);
c.setCellStyle(cs);
// String mess = getResources().getString(R.string.Cell14);
//String test =R.string.Cell14;
c = row.createCell(3);
//c.setCellValue("✘ NON ✘");
c.setCellValue(getResources().getString(R.string.Cell14));
c.setCellStyle(cs);
c = row.createCell(4);
c.setCellValue("");
c.setCellStyle(cs);
c = row.createCell(5);
c.setCellValue("");
c.setCellStyle(cs);
c = row.createCell(6);
c.setCellValue(NameDateNew);
c.setCellStyle(cs);
c = row.createCell(7);
c.setCellValue(NameHeureNew);
c.setCellStyle(cs);
c = row.createCell(8);
c.setCellValue("");
c.setCellStyle(csvide);
c = row.createCell(9);
c.setCellValue("");
c.setCellStyle(csvide);
c = row.createCell(10);
c.setCellValue("");
c.setCellStyle(csvide);
c = row.createCell(11);
c.setCellValue("");
c.setCellStyle(csvide);
再次,在二十行之后,细胞不再着色。任何援助将不胜感激。