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());
Ïà¹ØÎĵµ£º
ÔÚjavaÖУ¬¼ÙÉèÄãÓÐÒ»¸öuser ¶ÔÏóµÄlist£¬´Ëuser¶ÔÏó·â×°ÁËÓû§µÄid, first name, last name and age. È»ºóÄãÏëµ÷ÓÃÒ»¸öweb service(eg. UserService.deleteUsersByIds(List<Integer> userIds) ȥɾ³ýÊý¾Ý¿âÖÐÖ¸¶¨µÄÕâЩuser¡£ ÌýÆðÀ´Ëƺõ²»Ì«À§ÄÑ£¬²»ÊÇô? ÄãËùÐèÒªÖ»Êǽ« List<User> ת»¯³ÉList&l ......
public class TestClass{
public static void main(String args[]){
VarArgs(1, "one");
VarArgs(2, "one", "two");
VarArgs(3, "one", "two", "three");
VarArgs(0); // Attention!
}
static void VarArgs(int nRequired, String... trailing){
System.out.print("Required: " + nRequired + " ");
......
http://blog.csdn.net/hbcui1984/archive/2009/12/10/4980805.aspx
Ò»¡¢¸ÅÊö
JNI(java native interface)£¬JAVA±¾µØ½Ó¿Úµ÷Óã¬Ä¿µÄÊÇΪÁËJAVA¿ÉÒÔµ÷Óñ¾µØ³ÌÐò£¬Ö÷ÒªÓŵãÓУº
Ìá¸ßЧÂÊ£¬½â¾öÐÔÄÜÎÊÌâ
·ÀÖ¹·´±àÒ룬Ìá¸ßºËÐÄ´úÂ밲ȫÐÔ
ÔöÇ¿±¾»ú½Ó¿Úµ÷ÓÃ
ǶÈëʽ¿ª·¢Ó¦ÓÃ
ÈçÏÂͨ¹ýÒ»¸ö×î¼òµ¥µÄÐ ......