浏览代码

[bug-65227] add NPE guard in SheetUtil. Thanks to Petr Blaha

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888553 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_1_0
PJ Fanning 3 年前
父节点
当前提交
0c3aa44d36
共有 1 个文件被更改,包括 11 次插入9 次删除
  1. 11
    9
      poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java

+ 11
- 9
poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java 查看文件

@@ -160,18 +160,20 @@ public class SheetUtil {
double width = -1;
if (cellType == CellType.STRING) {
RichTextString rt = cell.getRichStringCellValue();
String[] lines = rt.getString().split("\\n");
for (String line : lines) {
String txt = line + defaultChar;
if (rt != null && rt.getString() != null) {
String[] lines = rt.getString().split("\\n");
for (String line : lines) {
String txt = line + defaultChar;

AttributedString str = new AttributedString(txt);
copyAttributes(font, str, 0, txt.length());
AttributedString str = new AttributedString(txt);
copyAttributes(font, str, 0, txt.length());

/*if (rt.numFormattingRuns() > 0) {
// TODO: support rich text fragments
}*/
/*if (rt.numFormattingRuns() > 0) {
// TODO: support rich text fragments
}*/

width = getCellWidth(defaultCharWidth, colspan, style, width, str);
width = getCellWidth(defaultCharWidth, colspan, style, width, str);
}
}
} else {
String sval = null;

正在加载...
取消
保存