如何将标题字体颜色更改为白色和填充绿色?这些是我正在使用的类:
import static org.apache.poi.ss.usermodel.CellStyle.*
import static org.apache.poi.ss.usermodel.IndexedColors.*
import org.apache.poi.hssf.usermodel.*
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.CellStyle
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.ss.usermodel.Sheet
import org.apache.poi.ss.usermodel.Workbook
import org.apache.poi.ss.usermodel.Font
这就是我相信必须插入的代码。
Font headerFont = wb.createFont();
headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD)
CellStyle headerStyle = wb.createCellStyle()
headerStyle.setFont(headerFont)
cellMOPID.setCellStyle(headerStyle)
cellType.setCellStyle(headerStyle)
cellStatus.setCellStyle(headerStyle)
cellState.setCellStyle(headerStyle)
cellStartDate.setCellStyle(headerStyle)
cellEndDate.setCellStyle(headerStyle)
cellDesc.setCellStyle(headerStyle)