将JSP表导出为Excel,Word,PDF [英] Exporting jsp tables to excel, word, pdf
本文介绍了将JSP表导出为Excel,Word,PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以向我建议任何可用于将表格导出到excel/pdf/word的库/jar文件.
Can anyone suggest me any library/jar files which I can use to export my table to excel/pdf/word.
请告诉我是否有可以在jsp中创建报告的库.
Please tell me if there is any library by which I can create reports in jsp.
推荐答案
还应该提到,只需输出HTML表并将response-type设置为application/vnd.ms-excel
,就可以将表导出到Excel.无需任何外部库.
It should also be mentioned that you can export tables to Excel simply by outputting an HTML table, and setting response-type to application/vnd.ms-excel
. No external libraries whatsoever needed.
类似这样的东西:
<%@ page language="java" session="true" %>
<%@ taglib uri="/WEB-INF/tld/response.tld" prefix="res" %>
<res:setHeader name="Content-Type">application/vnd.ms-excel</res:setHeader>
<res:setHeader name="Content-Disposition">attachment; filename=excel-test.xls</res:setHeader>
<table>
<tr>
<td>foo</td>
<td>bar</td>
</tr>
</table>
注意:此答案旨在补充此,因为它仅涵盖其中一种情况(Excel).
Note: this answer is meant to supplement this and this as it covers only one of the cases (Excel).
这篇关于将JSP表导出为Excel,Word,PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文