我正在研究如何使用单元格范围设置多个单元格的样式。查看我的代码以获取我当前的代码。预先感谢那些想要帮助我的人。
for (int counter = 0; counter < ColumnList.length; counter++) {
SXSSFCell cell = currentRow.createCell(counter);
if (counter == 0) {
cell.setCellValue(String.valueOf(rowNum));
cell.setCellStyle(cellStyle);
} else {
String columnValue = ColumnList[counter];
String cellValue = rs.getString(columnValue);
cell.setCellValue(cellValue);
cell.setCellStyle(cellStyle);
}
}
最佳答案
docs 上有一个 CellRangeAddress
其中有一个您可以使用的构造函数:
CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol)
关于java - 如何在 Apache poi 中设置多个单元格的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51057796/