Browse Source

feat: 导出修改信息

master
buaixuexideshitongxue 1 month ago
parent
commit
d55394e5a1
  1. 14
      src/main/java/com/biutag/supervision/service/ModifiedVerifyContentCellWriteHandler.java

14
src/main/java/com/biutag/supervision/service/ModifiedVerifyContentCellWriteHandler.java

@ -15,6 +15,7 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler {
private static final int MODIFIED_VERIFY_CONTENT_COLUMN_INDEX = 6;
private Font labelFont;
private Font arrowFont;
private CellStyle wrappedStyle;
@Override
@ -38,6 +39,10 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler {
if (separatorIndex > 0) {
richText.applyFont(offset, offset + separatorIndex, getLabelFont(workbook));
}
int arrowIndex = line.indexOf('→', separatorIndex + 1);
if (arrowIndex >= 0) {
richText.applyFont(offset + arrowIndex, offset + arrowIndex + 1, getArrowFont(workbook));
}
offset += line.length() + 1;
}
float requiredHeight = Math.max(cell.getRow().getHeightInPoints(), lines.length * 18F);
@ -54,6 +59,15 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler {
return labelFont;
}
private Font getArrowFont(Workbook workbook) {
if (arrowFont == null) {
arrowFont = workbook.createFont();
arrowFont.setBold(true);
arrowFont.setColor(IndexedColors.RED.getIndex());
}
return arrowFont;
}
private void applyWrappedStyle(Workbook workbook, Cell cell) {
if (wrappedStyle == null) {
wrappedStyle = workbook.createCellStyle();

Loading…
Cancel
Save