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

java parse excel

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
/**
* EXCELÎĵµ½âÎö¹¤¾ßÀà
* ¸Ã¹¤¾ßÄܽ«EXCELÎĵµÖеıí½âÎöΪÓÉJAVA»ù´¡À๹³ÉµÄÊý¾Ý¼¯ºÏ
* Õû¸öEXCEL±íÓɶà¸öÐÐ×é³É.ÿÐÐÓÃÒ»¸öLIST±íʾ.
* EXCELÖеÄÐÐÓÉÒ»¸öLIST±íʾ,¸÷ÁеÄÊý¾ÝË÷Òý´Ó0¿ªÊ¼Ò»Ò»¶ÔÆë´æ·ÅÔÚÕâ¸öLISTÖÐ;
* ¶à¸öÐй¹³ÉÕû¸ö±í,ÓÉÒ»¸öLIST´æ·Å¶à¸öÐÐ.
*
*******************************************
* com.trumptech.common.fileParser.excel
* 2007-6-15
* 16:20:38
* author linfan
*******************************************
*/
public class ExcelSheetParser {
private Logger logger= Logger.getLogger(ExcelSheetParser.class);
private HSSFWorkbook workbook ;
public ExcelSheetParser(File excelFile) throws FileNotFoundException, IOException{
   workbook = new HSSFWorkbook(new FileInputStream(excelFile));
}
/**
* »ñµÃ±íÖеÄÊý¾Ý
* @param sheetNumber ±í¸ñË÷Òý(EXCEL ÊǶà±íÎĵµ,ËùÒÔÐèÒªÊäÈë±íË÷ÒýºÅ)
* @return ÓÉLIST¹¹³ÉµÄÐкͱí
* @throws FileNotFoundException
* @throws IOException
*/
public List<List> getDatasInSheet(int sheetNumber) throws FileNotFoundException, IOException{
   List<List> result = new ArrayList<List>();
  
   //»ñµÃÖ¸¶¨µÄ±í
   HSSFSheet sheet = workbook.getSheetAt(sheetNumber);
  
   //»ñµÃÊý¾Ý×ÜÐÐÊý
   int rowCount = sheet.getLastRowNum();
   logger.info("found excel rows count: " + rowCount);
   if (rowCount < 1) {
    return result;
   }
  
   //ÖðÐжÁÈ¡Êý¾Ý
   for (int rowIndex = 0; rowIndex <= rowCount; rowIndex++) {
   
  &n


Ïà¹ØÎĵµ£º

ÖÂJavaÐÂÊÖµÄÒ»·âÐÅ£¨bxÈí¼þС×é°æ£©

ÏÂÃæÕâƪÎÄÕÂÊÇ̨ÍåÖøÃûJavaÂÛ̳“Javaworld”µÄÒ»¸ö×ÊÉî°æÖ÷дµÄÒ»·â¶ÔJavaÐÂÊÖµÄÐÅ£¬Ï£ÍûС×é³ÉÔ±×Ðϸ¿´Ï Äã»áѧµ½ºÜ¶àµÄ¡¢¡¢¡¢¡¢
 親愛µÄ java ÐÂÊÖ們 :
ºÜ¸ß興Äã們願Òâ來這裡¹²Í¬學習,
Java 這個語ÑÔ, ÒÑ&# ......

RedHat AS4ÅäÖÃJava»·¾³

µ½SunÍøÕ¾ÏÂÔØ×Ô½âѹ°²×°°üjdk-xxxx.bin
°²×°£º
[root@RHEL4 JDK-1.5.0.06]# chmod +x jdk-xxxx.bin
[root@RHEL4 JDK-1.5.0.06]# ./jdk-xxxx.bin
Ñ¡Ôñ°²×°Î»Öã¬
J2SDK°²×°Ä¿Â¼£º /usr/local/jdk
ÅäÖÃJava»·¾³±äÁ¿£º
ÔÚ ~/.bash_profile Àï¼ÓÈëÏÂÁм¸Ðл·¾³±äÁ¿¼´¿É£º
export JAVA_HOME=/usr/local/jdk
export PAT ......

ʹÓÃJNI¼¼ÊõʵÏÖJAVA³ÌÐòµ÷ÓÃdll

JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ­¾­¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿ÚºÍÉè±¸Í ......

javaµ÷ÓÃdllÀý×Ó


×î¼Ñ´ð°¸
1. ±àд·¶ÀýÎĵµ
public class TestNative
{
private native static int Max(int a,int b);
public static void main(String[] args)
{
System.out.println(Max(4,5));
}
static
{
System.loadLibrary("VCdll");
}
}
ÆäÖÐ
LoadLibraryÖеÄDLLÎļþÃû³Æ¿ÉÒÔ ......

java ½âÎö officeϵÁÐÎĵµ

²Î¿¼:
¡¡¡¡http://danadler.com/jacob/
¡¡¡¡http://jakarta.apache.org/poi/
¡¡¡¡http://www.onjava.com/pub/a/onjava/2003/01/22/poi.html
¡¡¡¡http://www.csdn.net/develop/article/15/15311.shtm
¡¡¡¡http://forum.java.sun.com/thread.jsp?forum=40&thread=382666&tstart=0&trange=15
¡¡¡¡Java Excel ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ