키는 HSSFRichTextString 개체를 사용하여 셀 값을 설정합니다. 이 객체는 applyFont 메서드를 가지고 있으며,이 메소드는 startingIndex, endingIndex 및 Font를 허용합니다. 따라서 원하는 색상을 가진 글꼴을 만든 다음 applyFont()를 사용하여 셀 값의 일부에 글꼴을 적용 할 수 있습니다. 여기
내가 함께 자갈길 몇 가지 예제 코드 (완전히 테스트되지 않은)입니다 :
// Set up a rudimentary worksheet with a cell in it
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet(“sheet1”);
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell(0);
// Set up fonts
HSSFFont blueFont = workbook.createFont();
blueFont.setColor(HSSFColor.BLUE.index);
HSSFFont greenFont = workbook.createFont();
greenFont.setColor(HSSFColor.GREEN.index);
// create a cell style and assign the first font to it
HSSFCellStyle style = workbook.createCellStyle();
style.setFont(blueFont);
// assign the style to the cell
cell.setCellStyle(style);
// override the parts of the text that you want to
// color differently by applying a different font.
HSSFRichTextString richString = new HSSFRichTextString("Hello, World!");
richString.applyFont(6, 13, greenFont);
cell.setCellValue(richString);
@BrianRogers 하나의 셀을 확인해 주셔서 감사합니다 여러 가지 색상을 가질 수 있습니다. –