|
@@ -2408,15 +2408,17 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
for (int i = 0; i < xssfRichTextString.numFormattingRuns(); i++) {
|
|
for (int i = 0; i < xssfRichTextString.numFormattingRuns(); i++) {
|
|
XSSFFont runFont = xssfRichTextString.getFontOfFormattingRun(i);
|
|
XSSFFont runFont = xssfRichTextString.getFontOfFormattingRun(i);
|
|
Font font = workbook.createFont();
|
|
Font font = workbook.createFont();
|
|
- font.setColor(runFont.getXSSFColor().getIndexed());
|
|
|
|
- font.setFontHeightInPoints(runFont.getFontHeightInPoints());
|
|
|
|
- font.setBold(runFont.getBold());
|
|
|
|
- font.setItalic(runFont.getItalic());
|
|
|
|
- font.setUnderline(runFont.getUnderline());
|
|
|
|
- font.setTypeOffset(runFont.getTypeOffset());
|
|
|
|
- font.setCharSet(runFont.getCharSet());
|
|
|
|
- font.setStrikeout(runFont.getStrikeout());
|
|
|
|
- font.setFontName(runFont.getFontName());
|
|
|
|
|
|
+ if (runFont!=null) {
|
|
|
|
+ font.setColor(runFont.getXSSFColor().getIndexed());
|
|
|
|
+ font.setFontHeightInPoints(runFont.getFontHeightInPoints());
|
|
|
|
+ font.setBold(runFont.getBold());
|
|
|
|
+ font.setItalic(runFont.getItalic());
|
|
|
|
+ font.setUnderline(runFont.getUnderline());
|
|
|
|
+ font.setTypeOffset(runFont.getTypeOffset());
|
|
|
|
+ font.setCharSet(runFont.getCharSet());
|
|
|
|
+ font.setStrikeout(runFont.getStrikeout());
|
|
|
|
+ font.setFontName(runFont.getFontName());
|
|
|
|
+ }
|
|
int startIdx = xssfRichTextString.getIndexOfFormattingRun(i);
|
|
int startIdx = xssfRichTextString.getIndexOfFormattingRun(i);
|
|
int endIdx = Math.min(startIdx + xssfRichTextString.getLengthOfFormattingRun(i), existingValue.length());
|
|
int endIdx = Math.min(startIdx + xssfRichTextString.getLengthOfFormattingRun(i), existingValue.length());
|
|
//根据原有值的长度,起始位置和结束位置设置成原有的文本格式
|
|
//根据原有值的长度,起始位置和结束位置设置成原有的文本格式
|