Java – export JSP tables to excel, word, pdf

Anyone can suggest me any library / jar file that I can use to export my table to excel / PDF / word

Please tell me if there is a library that can create reports in JSP

Solution

It should also be mentioned that you only need to output the HTML table and set the response type to application / vnd MS Excel, you can export the table to excel No external libraries are required

Something like this:

<%@ 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>

Note: this answer is intended to supplement this and this because it covers only one case (Excel)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>