alibaba/easyexcel

行背景色设置异常

Open

#3.674 geöffnet am 24. Jan. 2024

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (7.599 Forks)batch import
help wanted

Repository-Metriken

Stars
 (33.728 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

异常代码

  public class ForecastGrossRowWriteHandler2 implements RowWriteHandler {
    @Override
    public void afterRowDispose(RowWriteHandlerContext context) {
        Row row = context.getRow();
        Cell cell = row.getCell(8);
        CellStyle rowStyle = cell.getCellStyle();


        if (cell.toString().equals("流水")) {
            System.out.println("AA");
            rowStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
        } else {
            System.out.println("BB");
            rowStyle.setFillForegroundColor(IndexedColors.BLUE.getIndex());
        }
        rowStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        row.setRowStyle(rowStyle);
    }
}

异常提示

问题描述

导出的EXCEL全是背景蓝色 debug测试 System.out.println("AA")也是有执行的
正常应该红色还蓝色都有

Contributor Guide