JSP生成Excel电子表格(XLS)进行下载 [英] JSP generating Excel spreadsheet (XLS) to download

查看:152
本文介绍了JSP生成Excel电子表格(XLS)进行下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个我在JSP中开发的应用程序,我希望从XLS(MS Excel格式)的数据库中导出一些数据。



tomcat只是写一个文件,就像它是一个普通的Java应用程序,然后生成一个链接到这个文件?还是需要使用特定的API?



在执行此操作时,我有权限出现问题吗?

解决方案

您可以使用完整的库,如 JExcelAPI ,如果您设置响应,Excel还将读取CSV和纯HTML表MIME类型类似于application / vnd.ms-excel。



根据电子表格的复杂程度如何,CSV或HTML可以为您做这项工作,而无需第三方图书馆。


I have this application I'm developing in JSP and I wish to export some data from the database in XLS (MS Excel format).

Is it possible under tomcat to just write a file as if it was a normal Java application, and then generate a link to this file? Or do I need to use a specific API for it?

Will I have permission problems when doing this?

解决方案

While you can use a full fledged library like JExcelAPI, Excel will also read CSV and plain HTML tables provided you set the response MIME Type to something like "application/vnd.ms-excel".

Depending on how complex the spreadsheet needs to be, CSV or HTML can do the job for you without a 3rd party library.

这篇关于JSP生成Excel电子表格(XLS)进行下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆