Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Excel API——JXLÈëÃÅ

 
JXL(Java Excel API)ÊÇÒ»¸öÓÃÀ´¶¯Ì¬¶ÁдExcelÎļþµÄ¿ªÔ´¿ò¼Ü£¬ÀûÓÃËü¿ÉÒÔÔÚÈκÎÖ§³ÖJavaµÄ²Ù×÷ϵͳÉ϶¯Ì¬¶ÁдExcelÎļþ¡£JXLµÄÖ÷Ò³ÊÇ£ºhttp://www.andykhan.com/jexcelapi/£¬¿ÉÒÔÔÚÕâÀïÏÂÔص½ËüµÄ×îеİ汾¡£
Äã¿ÉÒÔ·Ö±ðͨ¹ýÈçÏÂÃüÁî
java -jar jxl.jar -xml test.xls
java -jar jxl.jar -cvs test.xls
ÒÔxmlºÍcvs¸ñʽ²é¿´test.xls£¬ÕâÊÇÒòΪJXL×÷ÕßʵÏÖÁËÒ»¸öÓÃÀ´ÑÝʾµÄjxl.demo.DemoµÄÀà¡£
µ±È»ÎÒÃÇʹÓÃJXLÖ÷ÒªÊÇÓÃËüÀ´¶¯Ì¬¶ÁдExcelÎļþ¡£ÏÖÔÚ¾ÍÀ´¿´¿´JXLÔÚ¶ÔExcelµÄ¶ÁºÍдÉ϶¼ÌṩÁËÄÇЩ֧³Ö¡£
ÏÈÀ´¿´¿´ExcelÎļþÖж¼ÓÐдÉÏÃæ¶ÔÏó
1 Îļþ¶ÔÏó 2¹¤×÷²¾¶ÔÏó 3 µ¥Ôª¸ñ¶ÔÏó¡£
ÏàÓ¦µÄÔÚJXLÖоÍÓÐWorkbook£¬Sheet £¬Cell ¡£Í¨¹ýÕâÈý¸ö¶ÔÏóÎÒÃǾͿÉÒÔʵÏÖExcelÎļþµÄ¶ÁÈ¡¹¤×÷¡£
ÎÒÃÇÏÈÏëÏëһ϶ÁÈ¡²½Ö裬²»¹ÜÊÇʲôÑùµÄExcel²Ù×÷¿ò¼Ü±Ø¶¨¶¼Òª¾­Àú
1Ñ¡È¡ExcelÎļþ£¬2Ñ¡Ôñ¹¤×÷²¾£¬3Ñ¡ÔñCell£¬4¶ÁÈ¡ÐÅÏ¢¡£
ÄÇôÏÖÔھͿÉÒÔ¿´¿´JXLÖÐÕâËIJ½ÖèÈçºÎÌåÏÖ£º
//ͨ¹ýWorkbookµÄ¾²Ì¬·½·¨getWorkbookÑ¡È¡ExcelÎļþ
Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));
//ͨ¹ýWorkbookµÄgetSheet·½·¨Ñ¡ÔñµÚÒ»¸ö¹¤×÷²¾£¨´Ó0¿ªÊ¼£©
Sheet sheet = workbook.getSheet(0);
//ͨ¹ýSheet·½·¨µÄgetCell·½·¨Ñ¡ÔñλÖÃΪC2µÄµ¥Ôª¸ñ£¨Á½¸ö²ÎÊý¶¼´Ó0¿ªÊ¼£©
Cell c2 = sheet.getCell(2,1);
//ͨ¹ýCellµÄgetContents·½·¨°Ñµ¥Ôª¸ñÖеÄÐÅÏ¢ÒÔ×Ö·ûµÄÐÎʽ¶ÁÈ¡³öÀ´
String stringc2 = c2.getContents();
¿ÉÒÔ¿´µ½ÕýÊǸղÅËù˵µÄËĸö²½Öè¡£
ÎÒÃǶ¼ÖªµÀExcelµ¥Ôª¸ñÊÇÓиñʽµÄ£¬ÄÇôÕâЩÐÅÏ¢ÈçºÎÈ¡µÃ¡£
CellÌṩÁËÒ»¸ögetType·½·¨Äܹ»·µ»Øµ¥Ôª¸ñµÄÀàÐÍÐÅÏ¢£¬Í¬Ê±JXLÌṩÁËÒ»¸öCellTypeÀàÓÃÀ´Ô¤ÉèExcelÖеÄÀàÐÍÐÅÏ¢£¬¶øÇÒJXLÌṩÁËһЩCellÀàµÄ×ÓÀàÓÃÀ´·Ö±ðÓÃÀ´±íʾ¸÷ÖÖÀàÐ͵ĵ¥Ôª¸ñ£¬ÈçLabelCell£¬NumberCell£¬DateCell·Ö±ð±íʾ×Ö·û¡¢ÊýÖµ¡¢ÈÕÆÚÀàÐ͵ĵ¥Ôª¸ñ¡£ËùÒÔÎÒÃÇ¿ÉÒÔÕâÑùд£º
if (c2.getType() == CellType.NUMBER)
{
  NumberCell nc = (NumberCell) c2;
  numberb2 = nc.getValue();
}
×îºó²»ÒªÍü¼Ç¹Ø±ÕworkbookÒÔÊÍ·Å×ÊÔ´£º
workbook.close();
ÏÖÔÚ×ܽáÒ»ÏÂ:Èý¸ö¶ÔÏó£¬Ëĸö²½Ö裬עÒâ¸ñʽ¡£¾Í¿ÉÒÔÇáËɵĴÓExcelÎļþÖжÁÈ¡Êý¾Ý¡£


Ïà¹ØÎĵµ£º

javaÓïÑÔÔÚ»¥ÁªÍøʱ´ú»ñµÃ¾Þ´ó³É¹¦

1995Ä꣬ÃÀ¹úSun Microsystems¹«Ë¾ÕýʽÏòITÒµ½çÍƳöÁËjavaÓïÑÔ£¬¸ÃÓïÑÔ¾ßÓа²È«¡¢¿çƽ̨¡¢ÃæÏò¶ÔÏó¡¢¼òµ¥¡¢ÊÊÓÃÓÚÍøÂçµÈÏÔÖøÌص㣬µ±Ê±ÒÔwebΪÖ÷ÒªÐÎʽµÄ»¥ÁªÍøÕýÔÚѸÃÍ·¢Õ¹£¬javaÓïÑԵijöÏÖѸËÙÒýÆðËùÓгÌÐòÔ±ºÍÈí¼þ¹«Ë¾µÄ¼«´ó¹Ø×¢£¬³ÌÐòÔ±ÃǷ׷׳¢ÊÔÓÃjavaÓïÑÔ±àдÍøÂçÓ¦ÓóÌÐò£¬²¢ÀûÓÃÍøÂç°Ñ³ÌÐò·¢²¼µ½ÊÀ½ç¸÷µØ½øÐÐÔËÐС ......

JavaÓïÑÔµÄÌصã(1)

¡¡1£® ¼òµ¥¡¢ÃæÏò¶ÔÏóºÍΪÈËËùÊìϤ
¡¡¡¡javaµÄ¼òµ¥Ê×ÏÈÌåÏÖÔÚ¾«¼òµÄϵͳÉÏ£¬Á¦Í¼ÓÃ×îСµÄϵͳʵÏÖ×ã¹»¶àµÄ¹¦ÄÜ£»¶ÔÓ²¼þµÄÒªÇ󲻸ߣ¬ÔÚСÐ͵ļÆËã»úÉϱã¿ÉÒÔÁ¼ºÃµÄÔËÐС£ºÍËùÓеÄÐÂÒ»´úµÄ³ÌÐòÉè¼ÆÓïÑÔÒ»Ñù£¬javaÒ²²ÉÓÃÁËÃæÏò¶ÔÏó¼¼Êõ²¢¸ü¼Ó³¹µ×£¬ËùÓеÄjava³ÌÐòºÍapplet³ÌÐò¾ùÊǶÔÏ󣬷â×°ÐÔʵÏÖÁËÄ£¿é»¯ºÍÐÅÏ¢Òþ²Ø£¬¼Ì³ÐÐÔ ......

JAVaÃæÊÔÌâ1

Java»ù´¡·½Ãæ: 
1¡¢×÷ÓÃÓòpublic,private,protected,ÒÔ¼°²»Ð´Ê±µÄÇø±ð
´ð£ºÇø±ðÈçÏ£º
×÷ÓÃÓò           µ±Ç°Àà       Í¬Ò»package  ×ÓËïÀà       ÆäËûpackage
public& ......

JavaµÄµ¥ÀýģʽÀý×Ó

1. ÏÈдһ¸öSingletonµÄclass
package stone;
public class Singleton {
    private static Singleton instance;
    private Singleton() {}
    public static Singleton getInstance(){
        if(instance==null)
  &n ......

JavaµÄ¹¤³§Ä£Ê½Àý×Ó

1. ¼òµ¥¹¤³§:
(1). ´´½¨Êä³ö(Output)½Ó¿Ú
package stone;
public interface Output {
    public int MAX_COUNT =10;               // ×î¶à¿É´òÓ¡¶àÉÙÌõ¼Ç¼
    public void show();     ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ