JavaWeb export excel file and pop up the download box

1、 Introduction

Reports are often involved in Java Web development. In recent projects, it is necessary to display the data in the database as a table and export it as an excel file.

2、 Related jar packages

Using POI can solve the problem of importing and exporting excel. POI download address: poi-3.6-20091214 jar

3、 Key code

First import the above jar package. When generating excel, the general data source form is a list. The code for generating excel format is posted below:

To write data into excel after generating excel format:

The generated excel is then output as a stream* Do not pop up the download box

*The download box pops up

After completing the above operations, you can jump to other pages. At the same time, POI can also upload and analyze excel and display it on the web page. Please look forward to this summary of another article!

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>