Exporting and importing data during development is often used. Recently, the company needs to import the specified data to a given excel template and merge cells as required. Here, I wrote a simple demo to summarize the knowledge points I have used for reference.
Download related Demo: poitest
Public class test {Public static void main (string [] ARGs ){Try {File
export Excel will open an Excel process, will not automatically shut down, if manually closed, you must traverse all the Excel process to kill, which will cause the problem can not be exported concurrently.Use steps
First step: Add a reference in the solution.
Here you use the. net2.0 version of Npoi 1.2.5, which requires two files to be referenced:
Npoi 1.2.
Use NPOI to export the information in the database to an Excel table and prompt the user to download it. npoiexcel
You can use NPOI to export an Excel table. On the Internet, I seldom find an Excel table to be exported and prompt to download it.
The simple code is as follows
. Net to download and upload excel files,. netexcel
The purpose of this article is to record problems encountered in the work, so that problems can be solved quickly in the future.
Page Tag:
FileName is the file name, for example:
String filename = "item color .xlsx"; HttpContext. current. response. contentType = "application/MS-excel"; HttpContext. current. re
Jxl.jar jxls-core-0.9. 9. Jar jxls-reader-0.9. 9. Jar Poi-3.5-final.jar (must be more than 3.5 version) other jars are prompted to go to http://jarvana.com/jarvana/Find//Generate Excel Incoming template file The content generation file to generate returns the build file The full path
public static string Doexcel (string from, Map beans, string to) {
ServletContext sc = (ServletContext) actioncontext.g Etcon
T-code:smw0Only binary data is introduced here, and the HTML template is uploaded as well.Alternatively, you can use the CBO table to manage the file to see my other blog post: CBO table management file upload downloadSelect binaryWrite Package Name:Click New after enteringPress the input button after entering the object name and descriptionSelect FileUpload complete.If you are prompted for the following information.MIME types can be maintained.In the
Jxl. jar jxls-core-0.9.9.jarjxls-reader-0.9.9.jarpoi-3.5-FINAL.jar (must be a version later than 3.5) other jar according to the prompts can go to the http://jarvana.com/jarvana/ to find // generate EXCEL input template file to generate the content of the file to return the complete path of the generated file public static string doexcel (string from, map beans, string to) {servletcontext SC = (servletconte
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.