Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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³ÌÐòʵÏÖÏß³ÌÁ¬½Ó³Ø¹¦ÄÜ

 import   java.util.LinkedList;  
   
  public   abstract   class   Manager   {  
   
          private   String   mThreadPoolName   =   null;  
   
    ......

Java Éè¼ÆÄ£Ê½(12)

Observer
Intent
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
How to
Subject
  
knows its observers. Any number of Observer objects may observe a subject.
  
provides an in ......

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


JXLµÄ´òÓ¡ÉèÖÃÔÚjxl.SheetSettingsÕâ¸öÀàÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý·½·¨Sheet£¨»òÕßWritableSheet£©#getSettings()»ñÈ¡¡£
1.Ò³Ãæ
1.1·½Ïò
SheetSetting#setOrientation(PageOrientation po)£»
²ÎÊý£º  PageOrientation#LANDSCAPE       ºáÏò´òÓ¡
PageOrientation# PO ......

javaÖÐ×Ö·û´®¶ÔÏóµÄ´´½¨¸öÊý

s = new String("xyz");´´½¨Á˼¸¸öString Object?Á½¸ö¶ÔÏó¡£
String s="ÄãºÃ";int i=3; s=i+s; Õâ¸ö±í´ïʽ¶ÔÂð?ÔÚjavaÖлáÌáʾÊý¾ÝÀàÐͲ»Æ¥Åä¡£ÒòΪstringÊÇÀà!ÕýÈ·×ö·¨: s+="3" »òÕß s+='3'»òÕß s+=(char)i;
ÎÒÃÇÒªÒýÈëÁíÍâÒ»ÖÖ´´½¨String¶ÔÏóµÄ·½Ê½µÄÌÖÂÛ——ÒýºÅÄÚ°üº¬Îı¾¡£ÕâÖÖ·½Ê½ÊÇStringÌØÓе쬲¢ÇÒË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ