개발/java
POI cell 색상 색상표
Yunikism
2024. 1. 26. 14:07
728x90
poi 를 사용하여 엑셀 파일 write 기능을 사용하던중 셀에 색상을 넣어야하는 경우가 찾아왔다
우선 사용법
// 워크북 생성
XSSFWorkbook workbook = new XSSFWorkbook();
// 워크시트 생성
XSSFSheet sheet = workbook.createSheet();
// 행 생성
XSSFRow row = sheet.createRow(0);
XSSFCellStyle cellStyleBlack = workbook.createCellStyle();
cellStyleBlack.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
cellStyleBlack.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell = row.createCell(0);
cell.setCellValue("이윤익최고");
cell.setCellStyle(cellStyle);
색상표는 이러하다.