问题描述
我正在尝试使用最新版本的 JXLS 从 Java 7 中的ArrayList生成XLS。
我不知道为什么它没有给出期望的输出。
Excel模板
输出Excel
Output Excel after below code gets run
所以输出等于模板内容。
Maven
<dependencies>
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-poi</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-reader</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
JAVA
List<Employee> employees = new ArrayList();
Employee employee = new Employee();
employee.setName("Employee name");
employees.add(employee);
try(InputStream is = new FileInputStream("D:\\template.xlsx")) {
try (OutputStream os = new FileOutputStream("D:\\output.xlsx")) {
Context context = new Context();
context.putVar("employees",employees);
JxlsHelper.getInstance().processTemplate(is,os,context);
}
}
链接: Referred link
注意:在控制台上没有错误
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)