Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 這個語ÑÔ, ÒÑ&# ......

×Ô¶¨ÒåJavaÒì³£

1.Ç°ÑÔ£º
ÄãµÄ³ÌÐò×ÜÓÐÒ»Ìì»á±ÀÀ£µô£¬ÔÚ±ÀÀ£µôµÄʱºòÎÒÃÇÒªÖªµÀËüÔÚÄÄ£¬ÎªÁËʲô¶ø±ÀÀ£µô£¬Êý¾ÝµÄ±£´æ»òÕ߶ªÊ§Çé¿öÈçºÎµÈÎÊÌâ¡£ÎÒÃÇ¿ÉÒÔͨ¹ý¼Ì³ÐÀàjava.lang.ThrowableµÄ×ÓÀࣺExceptionÀ´Éè¼ÆÎÒÃÇ×Ô¼ºµÄJavaÒì³£¡£ExceptionÀàÓÃÓÚÃèÊö³ÌÐòÄܹ»²¶»ñµÄÒì³££¬ÈçClassNotFoundException¡£Òª×¢ÒâµÄÊÇ×Ô¶¨ÒåÒì³£ÀàÖ®¼äÒ²¿ÉÒÔÓм ......

java jdbc Á¬½ÓOracle9i

     ×Ô¼ºÔÚ×öÕâ¸ö³ÌÐòµÄʱºò¿´¹ýºÜ¶àµÄ×ÊÁÏ£¬ÉÏÍøÒ²²éÁ˲»ÉÙµÄ×ÊÁÏ£¬¿ÉÊǶà°ë˵µÄÊdzöÉñÈ뻯£¬ÔÆÀïÎíÀï...²»¹â¿´Á˲»Ã÷°×£¬¶øÇÒÊÇÓÐÃ÷°×Ò»µãµÄÈË£¬¿´ÁËÒ²±äµÄÓÐЩģºýÁË¡£
     ÕâÀïÎÒÑÚÊÎÒ»Ì×ÍêÕûµÄjava jdbc Á¬½ÓOracle9iµÄ·¶Àý¡£
package com.lxh.dbcon;//´ò°ü
import ......

java±¨±íJXLºÍPOI´òÓ¡ÉèÖÃ


JXLµÄ´òÓ¡ÉèÖÃÔÚjxl.SheetSettingsÕâ¸öÀàÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý·½·¨Sheet£¨»òÕßWritableSheet£©#getSettings()»ñÈ¡¡£
1.Ò³Ãæ
1.1·½Ïò
SheetSetting#setOrientation(PageOrientation po)£»
²ÎÊý£º  PageOrientation#LANDSCAPE       ºáÏò´òÓ¡
PageOrientation# PO ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ