Browse Source

小于等于0则加粗

java8
han\hanst 3 weeks ago
parent
commit
ff5758e162
  1. 6
      src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java

6
src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java

@ -459,11 +459,11 @@ public class ExcelTemplate {
style7.setBorderBottom(BorderStyle.NONE); style7.setBorderBottom(BorderStyle.NONE);
style7.setBorderTop(BorderStyle.NONE); style7.setBorderTop(BorderStyle.NONE);
// 判断单元格的值是否小于0如果小于0则加粗
// 判断单元格的值是否小于等于0如果小于等于0则加粗
boolean isBold = false; boolean isBold = false;
if (c7.getCellType() == CellType.NUMERIC) { if (c7.getCellType() == CellType.NUMERIC) {
double cellValue = c7.getNumericCellValue(); double cellValue = c7.getNumericCellValue();
if (cellValue < 0) {
if (cellValue <= 0) {
isBold = true; isBold = true;
} }
} }
@ -661,7 +661,7 @@ public class ExcelTemplate {
int startRow = dtlRowIndex + heightInfo[0]; int startRow = dtlRowIndex + heightInfo[0];
int endRow = dtlRowIndex + heightInfo[1]; int endRow = dtlRowIndex + heightInfo[1];
int height = heightInfo[2]; int height = heightInfo[2];
for (int rowIdx = startRow; rowIdx <= endRow; rowIdx++) { for (int rowIdx = startRow; rowIdx <= endRow; rowIdx++) {
XSSFRow row = sheet.getRow(rowIdx); XSSFRow row = sheet.getRow(rowIdx);
if (row != null) { if (row != null) {

Loading…
Cancel
Save