mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add test
This commit is contained in:
parent
781b8efb72
commit
c16edabb7d
@ -22,11 +22,5 @@
|
|||||||
<artifactId>hutool-core</artifactId>
|
<artifactId>hutool-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.18.6</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -367,6 +367,34 @@ public class ExcelWriteTest {
|
|||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void writeBeanTest2() {
|
||||||
|
OrderExcel order1 = new OrderExcel();
|
||||||
|
order1.setId("1");
|
||||||
|
order1.setNum("123");
|
||||||
|
order1.setBody("body1");
|
||||||
|
|
||||||
|
OrderExcel order2 = new OrderExcel();
|
||||||
|
order1.setId("2");
|
||||||
|
order1.setNum("456");
|
||||||
|
order1.setBody("body2");
|
||||||
|
|
||||||
|
List<OrderExcel> rows = CollUtil.newArrayList(order1, order2);
|
||||||
|
// 通过工具类创建writer
|
||||||
|
String file = "f:/test/writeBeanTest2.xlsx";
|
||||||
|
FileUtil.del(file);
|
||||||
|
ExcelWriter writer = ExcelUtil.getWriter(file);
|
||||||
|
// 自定义标题
|
||||||
|
writer.addHeaderAlias("id", "编号");
|
||||||
|
writer.addHeaderAlias("num", "序号");
|
||||||
|
writer.addHeaderAlias("body", "内容");
|
||||||
|
// 一次性写出内容,使用默认样式
|
||||||
|
writer.write(rows, true);
|
||||||
|
// 关闭writer,释放内存
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void writeCellValueTest() {
|
public void writeCellValueTest() {
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package cn.hutool.poi.excel.test;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderExcel {
|
||||||
|
private String id;
|
||||||
|
private String num;
|
||||||
|
private String body;
|
||||||
|
}
|
6
pom.xml
6
pom.xml
@ -53,6 +53,12 @@
|
|||||||
<version>${junit.version}</version>
|
<version>${junit.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.6</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
|
Loading…
Reference in New Issue
Block a user