Use the java open source component JExcel to create non-differential Excel files and import them to the. net project.

Source: Internet
Author: User

Using the Excel component of MS Office to generate Excel has many drawbacks.
The first step is that the process is difficult to deploy. The second step is that all of excel.exe will be loaded into the memory every time it is generated, occupying at least 10 MB of memory. If a large file is generated, it will take at least 100-500 mb, not every server may suffer such memory loss, and each request will produce such a memory loss. therefore, it is not advisable to use this method without sufficient hardware conditions.

Therefore, in the process of system development, I thought of the java open source component POI. however, there is a problem: this is the Excel format of OpenOffice, which is a little different from the Excel format of MS Office. If it is read by your system, you can still understand it, however, when it comes to external integration systems, he will strictly require that the Excel format must be the same as the Excel format of MS Office. therefore, it is a little troublesome to use POI for generation.

So google ....

After finding JExcelAPI, JExcel is also an open-source API for generating Excel files in java and can generate non-differential Excel files. This is my choice and relative, it is much easier to develop than POI.
After 2 hours of test .. finally, we made a Console Application. hey, the effect is good, and the 3rd Part system can also be read. therefore, how to make the jar file in. net.

At the beginning, we used the method of calling Process. We found that it was not easy to use and it was very difficult to use...

Continue to develop the excellent tradition of programmers. go to google ....

Finally, I came across a good method. I used. net Java Virtual Machine to introduce jar to. net. It's good. But a JDK VM for. net has a total of 25 MB ....

So big ....

However, the implementation results are quite satisfactory. The next thing is to put these dll and exe in the project. OK, get it done.

The java code is pasted below:

Package Export:

Code

ExportApplication:

Code

The Tool I generated and the DLL to be referenced:

Http://files.cnblogs.com/cnherman/ExportToExcelTool.rar

The VM used is IKVM.

Http://www.IKVM.net

 

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.