ÀûÓÃJAVA¶ÁÈ¡EXCELÎļþ
1 ´ÓExcelÎļþ¶ÁÈ¡Êý¾Ý±í
Java Excel API¼È¿ÉÒÔ´Ó±¾µØÎļþϵͳµÄÒ»¸öÎļþ(.xls)£¬Ò²¿ÉÒÔ´ÓÊäÈëÁ÷ÖжÁÈ¡ExcelÊý¾Ý±í¡£¶ÁÈ¡ExcelÊý¾Ý±íµÄµÚÒ»²½ÊÇ´´½¨Workbook(ÊõÓ¹¤×÷±¡)£¬ÏÂÃæµÄ´úÂëÆ¬¶Î¾ÙÀý˵Ã÷ÁËÓ¦¸ÃÈçºÎ²Ù×÷£º
import java.io.*;
import jxl.*;
try
{
//¹¹½¨Workbook¶ÔÏó, Ö»¶ÁWorkbook¶ÔÏó
//Ö±½Ó´Ó±¾µØÎļþ´´½¨Workbook
//´ÓÊäÈëÁ÷´´½¨Workbook
InputStream is = new FileInputStream(sourcefile);
jxl.Workbook rwb = Workbook.getWorkbook(is);
}
catch (Exception e)
{
e.printStackTrace();
}
Ò»µ©´´½¨ÁËWorkbook£¬ÎÒÃǾͿÉÒÔͨ¹ýËüÀ´·ÃÎÊExcel Sheet(ÊõÓ¹¤×÷±í)¡£
//»ñÈ¡µÚÒ»ÕÅSheet±í
Sheet rs = rwb.getSheet(0);
ÎÒÃǼȿÉÄÜͨ¹ýSheetµÄÃû³ÆÀ´·ÃÎÊËü£¬Ò²¿ÉÒÔͨ¹ýϱêÀ´·ÃÎÊËü¡£Èç¹ûͨ¹ýϱêÀ´·ÃÎʵϰ£¬Òª×¢ÒâµÄÒ»µãÊÇϱê´Ó0¿ªÊ¼£¬¾ÍÏñÊý×éÒ»Ñù¡£
Ò»µ©µÃµ½ÁËSheet£¬ÎÒÃǾͿÉÒÔͨ¹ýËüÀ´·ÃÎÊExcel Cell(ÊõÓµ¥Ôª¸ñ)¡£²Î¿¼ÏÂÃæµÄ´úÂëÆ¬¶Î£º//»ñÈ¡µÚÒ»ÐУ¬µÚÒ»ÁеÄÖµ,ÁкÅÔÚÇ°Ãæ,ÐкÅÔÚºóÃæ
Cell c00 = rs.getCell(0, 0);
String strc00 = c00.getContents();
//»ñÈ¡µÚÒ»ÐУ¬µÚ¶þÁеÄÖµ
Cell c10 = rs.getCell(1, 0);
String strc10 = c10.getContents();
//»ñÈ¡µÚ¶þÐУ¬µÚ¶þÁеÄÖµ
Cell c11 = rs.getCell(1, 1);
String strc11 = c11.getContents();
System.out.println("Cell(0, 0)" + " value : " + strc00 + "; type : " + c00.getType());
System.out.println("Cell(1, 0)" + " value : " + strc10 + "; type : " + c10.getType());
System.out.println("Cell(1, 1)" + " value : " + strc11 + "; type : " + c11.getType());
Èç¹û½ö½öÊÇÈ¡µÃCellµÄÖµ£¬ÎÒÃÇ¿ÉÒÔ·½±ãµØÍ¨¹ýgetContents()·½·¨£¬Ëü¿ÉÒÔ½«ÈκÎÀàÐ͵ÄCellÖµ¶¼×÷Ϊһ¸ö×Ö·û´®·µ»Ø¡£Ê¾Àý´úÂëÖÐCell(0, 0)ÊÇÎı¾ÐÍ£¬Cell(1, 0)ÊÇÊý×ÖÐÍ£¬Cell(1,1)ÊÇÈÕÆÚÐÍ£¬Í¨¹ýgetContents()£¬ÈýÖÖÀàÐ͵ķµ»ØÖµ¶¼ÊÇ×Ö·ûÐÍ¡£
Èç¹ûÓÐÐèÒªÖªµÀCellÄÚÈݵÄÈ·ÇÐÀàÐÍ£¬APIÒ²ÌṩÁËһϵÁеķ½·¨¡£²Î¿¼ÏÂÃæµÄ´úÂëÆ¬¶Î£ºString strc00 = null;
double strc10 = 0.00;
Date strc11 = null;
Cell c00 = rs.getCell(0, 0);
Cell c10 = rs.getCell(1, 0);
Cell c11 = rs.getCell(1, 1);
if(c00.getType() == CellType.LABEL)
{
LabelCell labelc00 = (LabelCell)c00;
str
Ïà¹ØÎĵµ£º
¡¡¡¡inkfishÔ´´£¬ÇëÎðÉÌÒµÐÔÖÊ×ªÔØ£¬×ªÔØÇë×¢Ã÷À´Ô´£¨http://blog.csdn.net/inkfish£©¡£
¡¡¡¡ÕâÀïÐèÒª¹Ø×¢µÄÊÇBZIP2¸ñʽ£¬¾¹ý²âÊÔ£¬×ÜÊÇÎÞ·¨ÕýȷѹËõ£¬ÔÒòδ֪£¬¶øapache commons bzip2¸ñʽµÄÎļþѹËõÕý³£¡££¨À´Ô´£ºhttp://blog.csdn.net/inkfish£©
Ant ZIPѹËõ£º£¨À´Ô´£ºhttp://blog.csdn.net/inkfish£©
package stu ......
javaÊÇÒ»ÖÖÃæÏò¶ÔÏóµÄ±à³ÌÓïÑÔ£¬ÔõôÀí½â£¿
javaдµÄ³ÌÐò¶¼ÊÇÃæÏò¶ÔÏóµÄÂð£¿
Äã¿ÉÄÜÈÏΪ£¬javaÉúÀ´¾ÍÊÇÃæÏò¶ÔÏóµÄ¡£
ÇÒ¿´£º
package cn.nileader.calculate_OPP;
import java.util.Scanner;
/**
* ÕâÊÇÒ»¸öOPPµÄµÄ¼ÆËãÆ÷(¼Ó·¨ºÍ¼õ·¨)
* @author nileader
* @see http://www.nileader.cn
*/
public cla ......
¡¡¡¡inkfishÔ´´£¬ÇëÎðÉÌÒµÐÔÖÊ×ªÔØ£¬×ªÔØÇë×¢Ã÷À´Ô´£¨http://blog.csdn.net/inkfish
£©¡£
¡¡¡¡ÔÚÑ¡ÔñѹËõ¡¢´ò°üËã·¨µÄʱºò£¬²»½ö½öҪѡÔñËã·¨£¬»¹ÐèҪѡÔñÓÃÄĸöʵÏÖÀà¿â£¬²»Í¬µÄʵÏÖÀà¿âʵÏÖЧÂʲ»Í¬£¬Ä¬ÈÏѹËõ±ÈÂʲ»Í¬¡£ÎªÁ˲âÊÔJDK¡¢Ant¡¢commons-compressÔÚĬÈÏÇé¿öϵÄЧÂÊ£¬Éè¼ÆÁËÈçϳÌÐò£º£¨À´Ô´£ºhttp://blog.c ......
---09 11 29---
Servlet&ServletÈÝÆ÷:
Java Servlet(Java·þÎñÆ÷С³ÌÐò)ÊÇÒ»¸ö»ùÓÚJava¼¼ÊõµÄС³ÌÐò,
ÔËÐÐÔÚ·þÎñÆ÷¶Ë,ÓÉServletÈÝÆ÷Ëù¹ÜÀí,ÓÃÓÚÉú³É¶¯Ì¬µÄÄÚÈÝ.
ServletÊÇÆ½Ì¨¶ÀÁ¢µÄJavaÀà,ËùÒÔ±àдһ¸öServletʵ¼ÊÉϾÍÊǰ´
ÕÕservlet¹æ·¶±àдһ¸öJavaÀà.
ServletÈÝÆ÷Ò²½Ð×öServletÒýÇæ,ÊÇweb·þÎñÆ÷»òÓ¦Óà ......
ת×Ôhttp://hi.baidu.com/oyamao/blog/item/bcc75d5128468868843524eb.html
Òì³£´¦ÀíÊdzÌÐòÉè¼ÆÖÐÒ»¸ö·Ç³£ÖØÒªµÄ·½Ã棬ҲÊdzÌÐòÉè¼ÆµÄÒ»´óÄѵ㣬´ÓC¿ªÊ¼£¬ÄãÒ²ÐíÒѾ֪µÀÈçºÎÓÃif...else...À´¿ØÖÆÒì³£ÁË£¬Ò²ÐíÊÇ×Ô·¢µÄ£¬È»¶øÕâÖÖ¿ØÖÆÒ쳣ʹ¿à£¬Í¬Ò»¸öÒì³£»òÕß´íÎóÈç¹û¶à¸öµØ·½³öÏÖ£¬ÄÇôÄãÿ¸öµØ·½¶¼Òª×öÏàͬ´¦Àí£¬¸Ð¾õÏൠ......