|
|
|
@ -9,6 +9,8 @@ import org.apache.poi.ss.usermodel.Font; |
|
|
|
import org.apache.poi.ss.usermodel.IndexedColors; |
|
|
|
import org.apache.poi.ss.usermodel.IndexedColors; |
|
|
|
import org.apache.poi.ss.usermodel.RichTextString; |
|
|
|
import org.apache.poi.ss.usermodel.RichTextString; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFColor; |
|
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFFont; |
|
|
|
|
|
|
|
|
|
|
|
public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler { |
|
|
|
public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler { |
|
|
|
|
|
|
|
|
|
|
|
@ -35,11 +37,11 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler { |
|
|
|
String[] lines = content.split("\\n", -1); |
|
|
|
String[] lines = content.split("\\n", -1); |
|
|
|
int offset = 0; |
|
|
|
int offset = 0; |
|
|
|
for (String line : lines) { |
|
|
|
for (String line : lines) { |
|
|
|
int separatorIndex = line.indexOf(':'); |
|
|
|
int separatorIndex = line.indexOf('\uFF1A'); |
|
|
|
if (separatorIndex > 0) { |
|
|
|
if (separatorIndex > 0) { |
|
|
|
richText.applyFont(offset, offset + separatorIndex, getLabelFont(workbook)); |
|
|
|
richText.applyFont(offset, offset + separatorIndex, getLabelFont(workbook)); |
|
|
|
} |
|
|
|
} |
|
|
|
int arrowIndex = line.indexOf('→', separatorIndex + 1); |
|
|
|
int arrowIndex = line.indexOf('\u2192', separatorIndex + 1); |
|
|
|
if (arrowIndex >= 0) { |
|
|
|
if (arrowIndex >= 0) { |
|
|
|
richText.applyFont(offset + arrowIndex, offset + arrowIndex + 1, getArrowFont(workbook)); |
|
|
|
richText.applyFont(offset + arrowIndex, offset + arrowIndex + 1, getArrowFont(workbook)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -63,8 +65,12 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler { |
|
|
|
if (arrowFont == null) { |
|
|
|
if (arrowFont == null) { |
|
|
|
arrowFont = workbook.createFont(); |
|
|
|
arrowFont = workbook.createFont(); |
|
|
|
arrowFont.setBold(true); |
|
|
|
arrowFont.setBold(true); |
|
|
|
|
|
|
|
if (arrowFont instanceof XSSFFont xssfFont) { |
|
|
|
|
|
|
|
xssfFont.setColor(new XSSFColor(new byte[]{(byte) 255, 0, 0}, null)); |
|
|
|
|
|
|
|
} else { |
|
|
|
arrowFont.setColor(IndexedColors.RED.getIndex()); |
|
|
|
arrowFont.setColor(IndexedColors.RED.getIndex()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return arrowFont; |
|
|
|
return arrowFont; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|