Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Laubin729
easyexcel
提交
18025000
E
easyexcel
项目概览
Laubin729
/
easyexcel
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
easyexcel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
18025000
编写于
9月 16, 2019
作者:
庄家钜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复当cell为空可能会抛出空指针的bug
上级
1bfb8da9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
5 deletion
+7
-5
src/main/java/com/alibaba/excel/analysis/v07/handlers/DefaultCellHandler.java
...ibaba/excel/analysis/v07/handlers/DefaultCellHandler.java
+7
-5
未找到文件。
src/main/java/com/alibaba/excel/analysis/v07/handlers/DefaultCellHandler.java
浏览文件 @
18025000
...
...
@@ -7,6 +7,8 @@ import static com.alibaba.excel.constant.ExcelXmlConstants.CELL_TAG;
import
static
com
.
alibaba
.
excel
.
constant
.
ExcelXmlConstants
.
CELL_VALUE_TAG
;
import
static
com
.
alibaba
.
excel
.
constant
.
ExcelXmlConstants
.
CELL_VALUE_TYPE_TAG
;
import
java.util.Deque
;
import
java.util.LinkedList
;
import
java.util.Map
;
import
java.util.TreeMap
;
...
...
@@ -33,8 +35,7 @@ import com.alibaba.excel.util.StringUtils;
*/
public
class
DefaultCellHandler
implements
XlsxCellHandler
,
XlsxRowResultHolder
{
private
final
AnalysisContext
analysisContext
;
private
String
currentTag
;
private
String
currentCellIndex
;
private
Deque
<
String
>
currentTagDeque
=
new
LinkedList
<
String
>();
private
int
curCol
;
private
Map
<
Integer
,
CellData
>
curRowContent
=
new
TreeMap
<
Integer
,
CellData
>();
private
CellData
currentCellData
;
...
...
@@ -61,11 +62,10 @@ public class DefaultCellHandler implements XlsxCellHandler, XlsxRowResultHolder
@Override
public
void
startHandle
(
String
name
,
Attributes
attributes
)
{
currentTag
=
name
;
currentTag
Deque
.
push
(
name
)
;
// start a cell
if
(
CELL_TAG
.
equals
(
name
))
{
currentCellIndex
=
attributes
.
getValue
(
ExcelXmlConstants
.
POSITION
);
curCol
=
PositionUtils
.
getCol
(
currentCellIndex
);
curCol
=
PositionUtils
.
getCol
(
attributes
.
getValue
(
ExcelXmlConstants
.
POSITION
));
// t="s" ,it's means String
// t="str" ,it's means String,but does not need to be read in the 'sharedStrings.xml'
...
...
@@ -100,6 +100,7 @@ public class DefaultCellHandler implements XlsxCellHandler, XlsxRowResultHolder
@Override
public
void
endHandle
(
String
name
)
{
currentTagDeque
.
pop
();
if
(
CELL_VALUE_TAG
.
equals
(
name
))
{
// Have to go "sharedStrings.xml" and get it
if
(
currentCellData
.
getType
()
==
CellDataTypeEnum
.
STRING
)
{
...
...
@@ -133,6 +134,7 @@ public class DefaultCellHandler implements XlsxCellHandler, XlsxRowResultHolder
if
(
StringUtils
.
isEmpty
(
currentCellValue
))
{
return
;
}
String
currentTag
=
currentTagDeque
.
peek
();
if
(
currentTag
==
null
)
{
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录