アットウィキロゴ

POI g

package mat;
 
 
import java.io.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
 
 
public class readxls {
 
    int maxx,maxy;
   Cell[] cc=new Cell[600];
   String[][] mat=new String[5000][5000]; 
 
 void makedata(String file,int number){   
 
 
 
      try{
 
     FileInputStream is = new FileInputStream(file);
     Workbook wb = new HSSFWorkbook(is);
      Sheet sh = wb.getSheetAt(number);
 
      int s,sx,j;
      String bb;
 
      for(s=1;s<maxy+1;s++){
  Row row = sh.getRow(s-1);
  j=0;
  if(row==null)j=100;     
  for(sx=1;sx<maxx+1;sx++){  
  if(j<50)cc[sx] = row.getCell(sx-1);
  if (cc[sx] == null)cc[sx] = row.createCell(1);
   int type =cc[sx].getCellType();
       bb="";
       if(type==1)bb=cc[sx].getStringCellValue();
        if(type==0)bb=""+cc[sx].getNumericCellValue();
 
   mat[s][sx]=bb;
 
  }
  }
 
 
 
 
 
 
  } catch (Exception e) {e.printStackTrace();}
 
 
 
 
 
 
 
 }
}
 
最終更新:2014年01月20日 10:31