I. Introduction Java Excel API is an open source Java API that allows Java developers to generate an Excel spreadsheet, in addition, it includes a mechanism that allows Java applications to read Excel, modify some cells, written to a new spreadsheet. This set of API allows a pure Java application that processes and submits Excel spreadsheets, running under non-Windows operating systems. Because of Java, this API can be called in a servlet; so you can access Excel's functionality by web applications in Internet and corporate network;
Second, the characteristics:
1, read the data of Excel95, 97, 2000;
2, read and write EXCEL97 and subsequent formulas;
3, generate electronic forms in Excel2000 format;
4, support formatting on font, numbers, date;
5. Support for cell plus shadow and coloring;
6, modify the existing worksheet;
7, support the creation of the picture;
8, logging can be customized;
Third, Limitations: JEXCELAPI is not able to generate and read the information of the chart; this information is still saved when the chart is copied; when an image is added to the table, only the PNG format is supported. (I don't understand this part)
Fourth, starting using: This section will use a lot of demo to explain the use of this API;
1. Read the worksheet: When reading a worksheet, the demo is used as in a reasonable way, according to the original format to convert the Excel file to the CSV and XML format; java -jar jxl.jar -csv myspreadsheet .xls To view the table to XML, call the following demo: java -jar jxl.jar -Xml myspreadsheet.xls In order to introduce XLRD / CSV.JAVA and XLRD / XML.java, you need more work; The use of the class is just a start; from http://www.andykhan.com/jexcelapi/tutorial.html#reading you can get a guide.
2. Generating a Worksheet This write demo clarifies the most easily understood features of Jexcelapi in the generation of worksheets; worksheets have different fonts, digital formats, date formats, color, and process demonstrations through this demonstration. The worksheet, the JEXCELAPI call method is as follows: java -jar jxl.jar -write myspreadsheet.xls This will generate a sample worksheet called myspreadsheet.xls in the current directory; the class used to generate a worksheet is usually JXL / Write.java . This may be used in the beginning of a display process;
3, copy electronic data sheet JEXCELAPI can also be used to copy and modify worksheets; including jxcelapi called JXLRWTest.xls electronic data table, is a robust demo; if you run this electronic data table by command line, then a The copy of the electronic data sheet will be generated, and the second worksheet includes a modified value. Do not modify the demo's electronic data table, otherwise modifying the demo will not be able to run. Run the presentation from the directory containing jxlrwtest.xls; java -jar jxl.jar -rw jxlrwtest.xls myoutput.xls demo will generate an electronic data table called myoutput.xls, the first worksheet (called "initial ") There is no change, but the second work table (called" modified ") The title specified cell content changes. Class with modified features is jxl / readwrite.java. V. Operation Environment JEXCELAPI requires Java2 to run. When dealing with large electronic data tables, typically use the replication function function is recommended, and the user assigns enough memory to allow the java command to run the Java virtual machine using the -XMS and -XMX option.
6. Installing Jexcelapi is compressed into a TAR file, just like jexcelapi_2_0.tar.gz; in the UNIX system, use the following command to decompress. Gunzip jexcelapi_2_0.tar.gz Next TAR XF JEXCELAPI_2_0.TAR Using a command in the Linux system to decompress TAR ZXF JEXCELAPI_2_0.TAR.GZ in a Windows system, usually use software similar to WinZip to decompress. Regardless of how to decompress, this app will be placed in subdirects called Jexcelapi, the top directory includes, HTML web pages, jar packs prepared to compile, including public class documentation in jxl.jar.docs directory, In the build directory, the deployment file (need Ant), the src directory includes the source code of the Java class. 7. Excel version JEXCELAPI can read the Excel file created by Excel95, 97, 2000, which can generate a worksheet that can be read later by Excel97.
8. Licensing Jexcelapi is allowed to be issued within The GNU Lesser General Public Public License, please see http://www.gnu.org/copyleft/Lesser.html
Nine, detailed notes (http://www.andykhan.com/jexcelapi/tutorial.html) is beneficial to those who wish to master this group of APIs how to read, write, copy electronic data sheets. When entering the electronic data table, Jexcelapi supports the support for charts during copying, only they (referring to the previous chart) cannot read and output via the API. More detailed technical information, including how to handle the date and Unicode characters, see http://www.andykhan.com/jexcelapi/technotes.htm Technical documentation.