Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_879456671
easyexcel
提交
e358db4c
E
easyexcel
项目概览
qq_879456671
/
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 搜索 >>
提交
e358db4c
编写于
9月 17, 2021
作者:
庄家钜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改测试
上级
b7ef6e8d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
16 deletion
+12
-16
pom.xml
pom.xml
+1
-0
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
+1
-1
src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiTest.java
...est/java/com/alibaba/easyexcel/test/temp/poi/PoiTest.java
+10
-15
未找到文件。
pom.xml
浏览文件 @
e358db4c
...
...
@@ -172,6 +172,7 @@
<exclude>
com/alibaba/excel/metadata/format/DataFormatter.java
</exclude>
<exclude>
com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java
</exclude>
<exclude>
com/alibaba/excel/metadata/csv/CsvDataFormat.java
</exclude>
<exclude>
com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
</exclude>
</excludes>
</configuration>
<executions>
...
...
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
浏览文件 @
e358db4c
...
...
@@ -36,7 +36,7 @@ public class Lock2Test {
// File file = TestFileUtil.readUserHomeFile("test/test6.xls");
File
file
=
new
File
(
"/Users/zhuangjiaju/IdeaProjects/easyexcel/src/test/resources/converter/converter07.xlsx"
);
List
<
Object
>
list
=
EasyExcel
.
read
(
"/Users/zhuangjiaju/
Downloads/1 (2).xlsx"
).
sheet
(
0
).
doReadSync
();
List
<
Object
>
list
=
EasyExcel
.
read
(
"/Users/zhuangjiaju/
test/test3.xlsx"
).
sheet
(
0
).
headRowNumber
(
0
).
doReadSync
();
LOGGER
.
info
(
"数据:{}"
,
list
.
size
());
for
(
Object
data
:
list
)
{
LOGGER
.
info
(
"返回数据:{}"
,
CollectionUtils
.
size
(
data
));
...
...
src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiTest.java
浏览文件 @
e358db4c
...
...
@@ -3,11 +3,13 @@ package com.alibaba.easyexcel.test.temp.poi;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.util.Date
;
import
com.alibaba.easyexcel.test.util.TestFileUtil
;
import
com.alibaba.excel.util.FileUtils
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellCopyPolicy
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.xssf.streaming.SXSSFRow
;
...
...
@@ -21,11 +23,6 @@ import org.junit.Test;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.alibaba.easyexcel.test.util.TestFileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelReader
;
import
com.alibaba.excel.util.FileUtils
;
/**
* 测试poi
*
...
...
@@ -37,27 +34,25 @@ public class PoiTest {
@Test
public
void
lastRowNum
()
throws
IOException
{
String
file
=
TestFileUtil
.
getPath
()
+
"demo"
+
File
.
separator
+
"demo
.xlsx"
;
String
file
=
"/Users/zhuangjiaju/test/test3
.xlsx"
;
SXSSFWorkbook
xssfWorkbook
=
new
SXSSFWorkbook
(
new
XSSFWorkbook
(
file
));
SXSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
LOGGER
.
info
(
"一共行数:{}"
,
xssfSheet
.
getLastRowNum
());
SXSSFRow
row
=
xssfSheet
.
getRow
(
0
);
LOGGER
.
info
(
"第一行数据:{}"
,
row
);
xssfSheet
.
createRow
(
20
);
LOGGER
.
info
(
"一共行数:{}"
,
xssfSheet
.
getLastRowNum
());
Date
date
=
row
.
getCell
(
1
).
getDateCellValue
();
}
@Test
public
void
lastRowNumXSSF
()
throws
IOException
{
String
file
=
TestFileUtil
.
getPath
()
+
"demo"
+
File
.
separator
+
"demo
.xlsx"
;
String
file
=
"/Users/zhuangjiaju/test/test3
.xlsx"
;
XSSFWorkbook
xssfWorkbook
=
new
XSSFWorkbook
(
file
);
LOGGER
.
info
(
"一共:{}个sheet"
,
xssfWorkbook
.
getNumberOfSheets
());
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
LOGGER
.
info
(
"一共行数:{}"
,
xssfSheet
.
getLastRowNum
());
XSSFRow
row
=
xssfSheet
.
getRow
(
0
);
LOGGER
.
info
(
"第一行数据:{}"
,
row
);
xssfSheet
.
createRow
(
20
);
LOGGER
.
info
(
"一共行数:{}"
,
xssfSheet
.
getLastRowNum
());
Date
date
=
row
.
getCell
(
1
).
getDateCellValue
();
LOGGER
.
info
(
"date{}"
,
date
);
}
@Test
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录