java¶ÁÈ¡±¾µØexcelÎļþ´úÂë
package cn.com.view.read;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel {
public static void main(String[] args){
read("d://air.xls");
}
public static Cell[][] read(String fileName){
Workbook rwb = null;
InputStream is;
try {
is = new FileInputStream(fileName);
rwb = Workbook.getWorkbook(is);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int sheets = rwb.getNumberOfSheets();
Sheet rs = rwb.getSheet(0);
String sheetName = rs.getName();//»ñÈ¡SheetµÄÃû³Æ
int rsColumns = rs.getColumns();//»ñÈ¡Sheet±íÖÐËù°üº¬µÄ×ÜÁÐÊý
Cell[] cellCol = rs.getColumn(1); //»ñȡijһÁеÄËùÓе¥Ôª¸ñ£¬·µ»ØµÄÊǵ¥Ôª¸ñ¶ÔÏóÊý×é
int rsRows = rs.getRows(); //»ñÈ¡Sheet±íÖÐËù°üº¬µÄ×ÜÐÐÊý
Cell[] cellRow = rs.getRow(1); //»ñȡijһÐеÄËùÓе¥Ôª¸ñ£¬·µ»ØµÄÊǵ¥Ôª¸ñ¶ÔÏóÊý×é
// Cell cell = rs.getCell(0, 0); //µÚÒ»¸öÊÇÁÐÊý£¬µÚ¶þ¸öÊÇÐÐÊý
System.out.println("SheetµÄ¸öÊý£º"+sheets);
System.out.println("SheetµÄÃû³Æ£º"+sheetName);
System.out.println("ÁÐÊý£º"+rsColumns);
System.out.println("ÐÐÊý£º"+rsRows);
/* for(int i = 0;i < cellCol.length;i++){
System.out.println("µÚÒ»ÁÐ×ֶΣº"+cellCol[i].getContents());
Ïà¹ØÎĵµ£º
windows xpÏÂÅäÖÃJDK»·¾³±äÁ¿£º
1.°²×°JDK£¬°²×°¹ý³ÌÖпÉÒÔ×Ô¶¨Ò尲װĿ¼µÈÐÅÏ¢£¬ÀýÈçÎÒÃÇÑ¡Ôñ°²×°Ä¿Â¼ÎªD:\java\jdk1.5.0_08£»
¡¡ 2.°²×°Íê³Éºó£¬ÓÒ»÷“ÎҵĵçÄÔ”£¬µã»÷“ÊôÐÔ”£»
3.Ñ¡Ôñ“¸ß¼¶”Ñ¡Ï£¬µã»÷“ ......
ÔÚjavaÖУ¬¼ÙÉèÄãÓÐÒ»¸öuser ¶ÔÏóµÄlist£¬´Ëuser¶ÔÏó·â×°ÁËÓû§µÄid, first name, last name and age. È»ºóÄãÏëµ÷ÓÃÒ»¸öweb service(eg. UserService.deleteUsersByIds(List<Integer> userIds) ȥɾ³ýÊý¾Ý¿âÖÐÖ¸¶¨µÄÕâЩuser¡£ ÌýÆðÀ´Ëƺõ²»Ì«À§ÄÑ£¬²»ÊÇô? ÄãËùÐèÒªÖ»Êǽ« List<User> ת»¯³ÉList&l ......
ҪʹÓÃdom4j¶ÁдXMLÎĵµ,ÐèÒªÏÈÏÂÔØdom4j°ü,dom4j¹Ù·½ÍøÕ¾ÔÚ http://www.dom4j.org/
Ŀǰ×îÐÂdom4j°üÏÂÔØµØÖ·: http://nchc.dl.sourceforge.net/sourceforge/dom4j/dom4j-1.6.1.zip
½â¿ªºóÓÐÁ½¸ö°ü,½ö²Ù×÷XMLÎĵµµÄ»°°Ñdom4j-1.6.1.jar¼ÓÈ빤³Ì¾Í¿ÉÒÔÁË,Èç¹ûÐèҪʹÓÃXPathµÄ»°»¹ÐèÒª¼ÓÈë°üjaxen-1.1-beta-7.jar.
ÒÔÏÂ ......
È«ÇòʯÓÍÍø£¨www.cippe.net£©´´½¨ÓÚ2004Äê£¬ÖØµã±¨µÀÈ«ÇòʯÓ͹¤ÒµÐ²úÆ·¡¢Ð¼¼Êõ£¬¼á³ÖÆ·ÅÆ»¯¡¢×¨Òµ»¯¡¢¹ú¼Ê»¯µÄÕ½ÂÔ·¢Õ¹·½Ïò£¬´Ù½øÈ«ÇòʯÓ͹¤Òµ¼¼Êõ½»Á÷Óë×°±¸Ã³Ò×£¬ÍƽøÖйúʯÓ͹¤Òµ»¯·¢Õ¹ËÙ¶È£¡
ÍøÕ¾º¸ÇµØÖÊ¿±Ì½¡¢ÓÍÆø²Ø¡¢×ê¾®¡¢²â¾®¡¢²ÉÓÍ¡¢×°±¸¡¢º£ÑóʯÓÍ¡¢´¢ÔË¡¢Á¶»¯µÈרҵÁìÓò£¬´´°ìÁËʯÓÍ×ÊѶ¡¢Ð²úƷм¼Êõ¡¢Ê¯Ó ......
javaÉú³Éexcel±í¸ñ£¬ÒÔǰֻ֪µÀPOI£¬ÕâÊÇApacheµÄ¿ªÔ´ÏîÄ¿£¬±¾À´ÊÇÒ»Ì׵쬰üÀ¨word£¬µ«ÊÇÒòΪwordµÄ¸´ÔÓÐÔ£¬ÒÔ¼°¿ª·¢ÈËÔ±µÄȱ·¦£¬ºÃÏñ»ù±¾Í£ÖÍÁË¡£Ö»ÓÐExcel×öµÄ»¹Ëã±È½ÏÍêÕû£¬ÓÃÆðÀ´±È½ÏÇáËÉ¡£
ºóÀ´ÒòΪ×öÏîÄ¿µÄ¹ØÏµ£¬ÖªµÀÁË»¹ÓиöJXL£¨java excel£©£¬Ò²ÊǸö¿ªÔ´ÏîÄ¿£¬ÓÃÆðÀ´µÄ¸Ð¾õ¸úPOIºÜÀàËÆ£¬ÒòΪ ......