Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÎļþÖжÁÈ¡Êý¾Ý¡£


Ïà¹ØÎĵµ£º

´«ÖDz¥¿ÍJAVAÅàѵ2010 5 9


½ñÌìÊÇÏîÄ¿µÄµÚÈýÌìÁË£¬ºÍ×òÌìµÄÄÚÈݲ¶à£¬ËùÒÔ½ñÌìµÄ×ܽáûÓÐΧÈÆÏîÄ¿Õ¹¿ª£¬ÎÒÖ®ËùÒÔ£¬ÒªÄóöCVS/SVNÀ´ËµµÄÔ­ÒòÊÇÒòΪ°æ±¾¿ØÖÆÆ÷·Ç³£µÄÖØÒª£¬ÒòΪÒÔºóÎÒÃǽøÈ빫˾֮ºó£¬µÚÒ»´ÎÊÂÇé¾ÍÊǸæËßµ¥ÈË¿ª·¢µÄģʽ £¬´ó¼Ò¶¼ÖªµÀÔÚÆóÒµÀïÃ棬ÊDz»ÊÇÊÇÒ»¸öÈË¿ª·¢µÄ£¬ÊÇЭ×÷¿ª·¢¡£ËùÒÔ£¬×÷Ϊһ¸öÓпª·¢¾­ÑéµÄͬ־¶¼ÖªµÀ£¬ÕâÁ ......

java³ÌÐòÖе÷ÓÃÉãÏñͷʵÏÖjsp³ÌÐòÉãÏñÍ·Êý¾Ý²É¼¯

½üÆÚµÄÒ»¸öÏîÄ¿ÐèҪʵÏÖÉãÏñͷͼÏñ²É¼¯£¬¾­¹ýһϵÁеÄÕÛÌÚÒÔºó£¬ÖÕÓÚʵÏÖÁËÕâ¸ö¹¦ÄÜ£¬ÏÖÕûÀíһϡ£
±¾Éí¾Íjava¼¼ÊõÀ´Ëµ£¬ÒªÊµÏÖÉãÏñÍ·¶þ´Î¿ª·¢£¬²É¼¯ÉãÏñͷͼƬ£¬ÐèҪʹÓõ½JMF£¬JMFÊʺÏʹÓÃÔÚj2se³ÌÐòµ±ÖУ¬ÎÒÐèÒªÔÚweb³ÌÐòÖе÷ÓÃÉãÏñÍ·£¬ºÜÃ÷ÏÔJMFÊǸ㲻¶¨ÁË£¬Ïë¹ýдһ¸öapplet³ÌÐò£¬Ö»ÊÇÄǶ«Î÷ÒªÇó¿Í»§¶Ë±ØÐëÒªÓÐjre»·¾ ......

¼òÒ×JAVA»ñÈ¡ÍøÒ³ÓÐЧÓÊÏäµØÖ·

//  ¼òÒ×JAVA»ñÈ¡ÍøÒ³ÓÐЧÓÊÏäµØÖ· ---by 77
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class solo7 {
 public static void main(String args[]){
   ......

»ùÓÚJavaµÄÈ«ÎļìË÷ÒýÇæ¼ò½é


LuceneÊÇÒ»¸ö»ùÓÚJavaµÄÈ«ÎÄË÷Òý¹¤¾ß°ü¡£
»ùÓÚJavaµÄÈ«ÎÄË÷ÒýÒýÇæLucene¼ò½é£º¹ØÓÚ×÷ÕߺÍLuceneµÄÀúÊ·
È«ÎļìË÷µÄʵÏÖ£ºLueneÈ«ÎÄË÷ÒýºÍÊý¾Ý¿âË÷ÒýµÄ±È½Ï
ÖÐÎÄÇзִʻúÖƼò½é£º»ùÓÚ´Ê¿âºÍ×Ô¶¯ÇзִÊËã·¨µÄ±È½Ï
¾ßÌåµÄ°²×°ºÍʹÓüò½é£ºÏµÍ³½á¹¹½éÉܺÍÑÝʾ
Hacking Lucene£º¼ò»¯µÄ²éѯ·ÖÎöÆ÷£¬É¾³ýµÄʵÏÖ£¬¶¨ÖƵÄÅÅÐò£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ