アットウィキロゴ

p7798

package xslx;
 
import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Cell;
import java.io.*;
 
public class pro {
 
 
    String[][] mat=new String[15000][200]; 
    Cell cc;
 int maxx,maxy;
 int s,sx;
 int number;
 String[] credit=new String[200];
 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
 
    pro(){
 
        String file;
 
        maxx=100;
        maxy=7000;
 
        file="data/2.xlsx";
 
 
        readxlsx sub=new readxlsx();
        sub.maxx=maxx;
        sub.maxy=maxy;
        sub.makedata(file,0);
        mat=sub.mat;
 
 
        for(s=1;s<maxx+1;s++){
        if(mat[1][s].length()>0)number=s;
        credit[s]=mat[1][s];          
        }
 
 
        for(s=1;s<number+1;s++){
        System.out.println(credit[s]);  
        }
 
        int datanumber=0;
 
       for(s=1;s<maxy;s++){
       if(mat[s][1].length()>0)datanumber=s;
       }
 
       for(s=1;s<maxy;s++){
       if(mat[s][1].length()>0)datanumber=s;
       }
 
     for(s=1;s<datanumber+1;s++){
     System.out.println(mat[s][5]); 
    }
 
 
    } 
}
 
 
package xslx;
 
 
import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Cell;
import java.io.*;
 
public class readxlsx{
 
 
    String[][] mat=new String[10000][500]; 
    Cell cc;
 
  int maxx,maxy;  
 
    void makedata(String file,int num){
 
 
 
 
      try{
 
     FileInputStream is = new FileInputStream(file);
     XSSFWorkbook wb = new XSSFWorkbook(is);
      Sheet sh = wb.getSheetAt(num);
 
      int s,sx,j,h;
      String bb;
 
 
 
          for(s=1;s<maxy+1;s++){
           for(sx=1;sx<maxx+1;sx++){
          mat[s][sx]="";
           }}
 
  for(s=1;s<maxy+1;s++){
  Row row = sh.getRow(s-1);
  j=0;
  if(row==null)j=100;
  if(j<50){
  for(sx=1;sx<maxx+1;sx++){  
  cc = row.getCell(sx-1);
  h=0;
  if(cc==null)h=100;
  if(h<50){
  int type =cc.getCellType();
   bb="";
  if(type==1)bb=cc.getStringCellValue();
  if(type==0)bb=""+cc.getNumericCellValue();
 
 
  mat[s][sx]=bb;
  }
  }
  }
  }
 
 
 
 
 
  } catch (Exception e) {e.printStackTrace();}
 
 
 
    }
 
 
 
}
 
最終更新:2016年06月13日 04:56