javaµ¼Èëµ¼³öexcel²Ù×÷(jxl)
¹Ø¼ü×Ö: java excel jxl.jar
jxl.jar °ü
ÏÂÔصØÖ·:
ÕæʵÏÂÔصØÖ·:
ÍøÕ¾É϶ÔËüµÄÌØÕ÷ÓÐÈçÏÂÃèÊö£º
¡ñ Ö§³ÖExcel 95-2000µÄËùÓа汾
¡ñ Éú³ÉExcel 2000±ê×¼¸ñʽ
¡ñ Ö§³Ö×ÖÌå¡¢Êý×Ö¡¢ÈÕÆÚ²Ù×÷
¡ñ Äܹ»ÐÞÊε¥Ôª¸ñÊôÐÔ
¡ñ Ö§³ÖͼÏñºÍͼ±í
Ó¦¸Ã˵ÒÔÉϹ¦ÄÜÒѾÄܹ»´óÖÂÂú×ãÎÒÃǵÄÐèÒª¡£×î¹Ø¼üµÄÊÇÕâÌ×APIÊÇ´¿JavaµÄ£¬²¢²»ÒÀÀµWindowsϵͳ£¬¼´Ê¹ÔËÐÐÔÚLinuxÏ£¬ËüͬÑùÄܹ»ÕýÈ·µÄ´¦ÀíExcelÎļþ¡£ÁíÍâÐèҪ˵Ã÷µÄÊÇ£¬ÕâÌ×API¶ÔͼÐκÍͼ±íµÄÖ§³ÖºÜÓÐÏÞ£¬¶øÇÒ½ö½öʶ±ðPNG¸ñʽ¡£
´î½¨»·¾³
½«ÏÂÔغóµÄÎļþ½â°ü£¬µÃµ½jxl.jar£¬·ÅÈëclasspath£¬°²×°¾ÍÍê³ÉÁË¡£
»ù±¾²Ù×÷
Ò»¡¢´´½¨Îļþ
ÄâÉú³ÉÒ»¸öÃûΪ“²âÊÔÊý¾Ý.xls”µÄExcelÎļþ£¬ÆäÖеÚÒ»¸ö¹¤×÷±í±»ÃüÃûΪ“µÚÒ»Ò³”£¬´óÖÂЧ¹ûÈçÏ£º
Java´úÂë
/*
* Created on Dec 30, 2007
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package JExcelTest.standard;
import java.io.*;
import jxl.*;
import jxl.write.*;
/**
* @author Ken
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CreateXLS {
public static void main(String[] args) {
try {
//open file.
WritableWorkbook book = Workbook.createWorkbook(new File("d:/Test.xls"));
//create Sheet named "Sheet_1". 0 means this is 1st page.
WritableSheet sheet = book.createSheet("Sheet_1", 0);
//define cell column and row in Label Constructor, and cell content write "test".
//cell is 1st-Column,1st-Row. value is "test".
Label label = new Label(0, 0, "test");
//add defined cell above to sheet instance.
sheet.addCell(label);
//create cell using add numeric. WARN:necessarily use integrated package-path, otherwise will be throws path-error.
//cell is 2nd-Column, 1st-Row. value is 789.123.
jxl.write.Number number = new jxl.write.Number(1, 0, 789.123);
//add defined cell above to sheet instance.
sheet.addCell(number);
//add defined all cell above to case.
book.write()
Ïà¹ØÎĵµ£º
Ëæ×Å»¥ÁªÍøµÄÈÕÒæ׳´ó,ÍøÕ¾µÄpvºÍuv³ÉÏßÐÔ»òÕßÖ¸Êý±¶µÄÔö¼Ó.µ¥·þÎñÆ÷µ¥Êý¾Ý¿âÔçÒѾ²»ÄÜÂú×ãʵ¼ÊÐèÇó.±ÈÈçÏñÊ¢´ó,ÌÔ±¦ÕâÑùµÄ´óÐÍÍøÂ繫˾,¸üÊÇÈç´Ë.
¼¯Èº,Ò²¾ÍÊÇÈÃÒ»×é¼ÆËã»ú·þÎñÆ÷Ðͬ¹¤×÷,´ï½â¾ö´ó²¢·¢,´óÊý¾ÝÁ¿Æ¿¾±ÎÊÌâ.µ«ÊÇÔÚȺ¼¯ÖÐ,sessionÍùÍùÊÇÒ»¸ö±È½ÈÍ·ÌÛµÄÎ ......
1.¶ÁÈ¡XMLÎļþµÄÀࣺ
public class XMLUtils {
private final String DB_XML_FILE = "/XMLSetting.xml";
public Properties getPropertiesfromXML() {
URL url = XMLUtils.class.getResource(dBXMLFILE);
URI uri;
try {
uri = url.toURI();
InputSource xmlfile = new InputSource(uri.g ......
Ê×ÏÈҪ˵µÄÊÇ,HibernateÖÐORMÀï¶ÔÓ¦µÄÓ³ÉäÎļþBEAN,±ØÐëʵÏÖÐòÁл¯.ÒòΪBEANÀïµÄÊý¾ÝÐèÒª´æÈëÊý¾Ý¿â(Ҫת»¯Îª¶þ½øÖƱ£´æ),½øÐдæÈ¡¹¤×÷.
JAVAÀàµÄÊý¾Ý ,Èç¹ûÒª½øÐÐÏà¹ØµÄ´æ´¢¹¤×÷(ÈçдÎļþ,ÍøÂç´«Êä,дÊý¾Ý¿âµÈ),ÄÇôÕâ¸öÊý¾ÝµÄÀà ¾Í±ØÐëʵÏÖÐòÁл¯½Ó¿Ú (java.io.Serializable ......
import java.net.*;
import java.io.*;
public class PortScanner {
public static void main(String args[]){
String host="localhost";
new PortScanner().scan(host);
}
public void scan(String host){
  ......
import java.text.Format;
import java.text.SimpleDateFormat;
File file = new File("a.txt");
long time = file.lastModified();
Date d = new Date(time);
Format simpleFormat = new SimpleDateFormat("E dd MMM yyyy hh:mm:ss a");
String dateString = simpleFormat.format(d);
System.err.println(file.getN ......