Table To Xls HTML表格转Excel 项目简介
Java实现,HTML table转换为Excel,支持大部分样式,欢迎提出意见或者建议,后续可能,只是说可能会增加外部样式支持。有图有真相:转换结果:欢迎捧场,拍砖。使用方式:1、添加Maven依赖 <dependency>
<groupId>me.chyxion</groupId>
<artifactId>table-to-xls</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>2、使用StringBuilder html = new StringBuilder();
Scanner s = new Scanner(getClass().getResourceAsStream("/sample.html"), "utf-8");
while (s.hasNext()) {
html.append(s.nextLine());
}
s.close();
FileOutputStream fout = new FileOutputStream("data.xls");
fout.write(TableToXls.process(html));
fout.close();好了,大功告成。
<groupId>me.chyxion</groupId>
<artifactId>table-to-xls</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>2、使用StringBuilder html = new StringBuilder();
Scanner s = new Scanner(getClass().getResourceAsStream("/sample.html"), "utf-8");
while (s.hasNext()) {
html.append(s.nextLine());
}
s.close();
FileOutputStream fout = new FileOutputStream("data.xls");
fout.write(TableToXls.process(html));
fout.close();好了,大功告成。