Làm cách nào để thay đổi màu phông chữ tiêu đề thành màu trắng và tô màu xanh lục? Đây là các lớp mà tôi đang sử dụng:Làm cách nào để thay đổi Màu Văn bản và Fillcolor
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
Và đây là mã mà tôi tin rằng nó sẽ được chèn vào.
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)
Tệp jar nào là XSSFCellStyle nằm trong? Điều này trông giống như những gì tôi cần! –
Tôi đang sử dụng apache poi 3.9. XSSFCellStyle nằm trong org.apache.poi.xssf.usermodel.XSSFCellStyle – Sankumarsingh
Tôi liệt kê nhập org.apache.poi.xssf.usermodel.XSSFCellStyle ở đầu tài liệu của tôi nhưng tôi nhận được "không thể phân giải lớp org.apache.poi .xssf.usermodel.XSSFCellStyle "message. Điều này có nghĩa là tôi không có nó? –