Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
苏木力格
easyexcel
提交
4980ee91
E
easyexcel
项目概览
苏木力格
/
easyexcel
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
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,发现更多精彩内容 >>
提交
4980ee91
编写于
9月 02, 2019
作者:
庄家钜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改换行数据无法读取的bug
上级
13956040
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
11 deletion
+60
-11
src/main/java/com/alibaba/excel/analysis/v07/SharedStringsTableHandler.java
...alibaba/excel/analysis/v07/SharedStringsTableHandler.java
+15
-9
src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java
...om/alibaba/excel/metadata/property/ExcelHeadProperty.java
+2
-2
src/test/java/com/alibaba/easyexcel/test/temp/simple/HgTest.java
...t/java/com/alibaba/easyexcel/test/temp/simple/HgTest.java
+42
-0
update.md
update.md
+1
-0
未找到文件。
src/main/java/com/alibaba/excel/analysis/v07/SharedStringsTableHandler.java
浏览文件 @
4980ee91
...
@@ -16,11 +16,11 @@ public class SharedStringsTableHandler extends DefaultHandler {
...
@@ -16,11 +16,11 @@ public class SharedStringsTableHandler extends DefaultHandler {
/**
/**
* The final piece of data
* The final piece of data
*/
*/
private
String
currentData
;
private
String
Builder
currentData
;
/**
/**
* Current element data
* Current element data
*/
*/
private
String
currentElementData
;
private
String
Builder
currentElementData
;
private
ReadCache
readCache
;
private
ReadCache
readCache
;
...
@@ -40,20 +40,26 @@ public class SharedStringsTableHandler extends DefaultHandler {
...
@@ -40,20 +40,26 @@ public class SharedStringsTableHandler extends DefaultHandler {
@Override
@Override
public
void
endElement
(
String
uri
,
String
localName
,
String
name
)
{
public
void
endElement
(
String
uri
,
String
localName
,
String
name
)
{
if
(
T_TAG
.
equals
(
name
))
{
if
(
T_TAG
.
equals
(
name
))
{
if
(
currentData
==
null
)
{
if
(
currentElementData
!=
null
)
{
currentData
=
currentElementData
;
if
(
currentData
==
null
)
{
}
else
{
currentData
=
new
StringBuilder
();
if
(
currentElementData
!=
null
)
{
currentData
+=
currentElementData
;
}
}
currentData
.
append
(
currentElementData
);
}
}
}
else
if
(
SI_TAG
.
equals
(
name
))
{
}
else
if
(
SI_TAG
.
equals
(
name
))
{
readCache
.
put
(
currentData
);
if
(
currentData
==
null
)
{
readCache
.
put
(
null
);
}
else
{
readCache
.
put
(
currentData
.
toString
());
}
}
}
}
}
@Override
@Override
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
{
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
{
currentElementData
=
new
String
(
ch
,
start
,
length
);
if
(
currentElementData
==
null
)
{
currentElementData
=
new
StringBuilder
();
}
currentElementData
.
append
(
new
String
(
ch
,
start
,
length
));
}
}
}
}
src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java
浏览文件 @
4980ee91
...
@@ -137,8 +137,8 @@ public class ExcelHeadProperty {
...
@@ -137,8 +137,8 @@ public class ExcelHeadProperty {
continue
;
continue
;
}
}
if
(
customFiledMap
.
containsKey
(
excelProperty
.
index
()))
{
if
(
customFiledMap
.
containsKey
(
excelProperty
.
index
()))
{
throw
new
ExcelGenerateException
(
"The index of "
+
customFiledMap
.
get
(
excelProperty
.
index
()).
getName
()
throw
new
ExcelGenerateException
(
"The index of
'
"
+
customFiledMap
.
get
(
excelProperty
.
index
()).
getName
()
+
"
and "
+
field
.
getName
()
+
"
must be inconsistent"
);
+
"
' and '"
+
field
.
getName
()
+
"'
must be inconsistent"
);
}
}
customFiledMap
.
put
(
excelProperty
.
index
(),
field
);
customFiledMap
.
put
(
excelProperty
.
index
(),
field
);
}
}
...
...
src/test/java/com/alibaba/easyexcel/test/temp/simple/HgTest.java
0 → 100644
浏览文件 @
4980ee91
package
com.alibaba.easyexcel.test.temp.simple
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.List
;
import
org.apache.poi.xssf.streaming.SXSSFRow
;
import
org.apache.poi.xssf.streaming.SXSSFSheet
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.alibaba.easyexcel.test.temp.poi.PoiTest
;
import
com.alibaba.easyexcel.test.util.TestFileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.fastjson.JSON
;
/**
* 测试poi
*
* @author Jiaju Zhuang
**/
@Ignore
public
class
HgTest
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
HgTest
.
class
);
@Test
public
void
hh
()
throws
IOException
{
List
<
Object
>
list
=
EasyExcel
.
read
(
new
FileInputStream
(
"D:\\test\\hg2.xlsx"
)).
sheet
().
headRowNumber
(
0
).
doReadSync
();
for
(
Object
data
:
list
)
{
LOGGER
.
info
(
"返回数据:{}"
,
JSON
.
toJSONString
(
data
));
}
}
}
update.md
浏览文件 @
4980ee91
# 2.0.0-beta2
# 2.0.0-beta2
*
加速gc回收
[
Issue #511
](
https://github.com/alibaba/easyexcel/issues/511
)
*
加速gc回收
[
Issue #511
](
https://github.com/alibaba/easyexcel/issues/511
)
*
修改空字符串读取可能读取上个字段的数据的bug
*
修改空字符串读取可能读取上个字段的数据的bug
*
修改换行数据无法读取的bug
# 2.0.0-beta1
# 2.0.0-beta1
*
优化读写逻辑
*
优化读写逻辑
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录