package xls;
import java.io.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
public class pro {
String[][] mat=new String[500][400];
int[][] col=new int[500][400];
String[] artist=new String[500];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
try{
FileInputStream is = new FileInputStream("420.xls");
Workbook wb = new HSSFWorkbook(is);
Sheet sh = wb.getSheetAt(0);
int s,sx,j,h;
String bb;
CellStyle style = wb.createCellStyle();
for(s=1;s<500;s++){
for(sx=1;sx<50;sx++){
mat[s][sx]="";
}}
for(s=1;s<500;s++){
Row row = sh.getRow(s-1);
j=0;
if(row==null)j=100;
if(j<50){
for(sx=1;sx<50;sx++){
Cell 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();
short n1=cc.getCellStyle().getFillBackgroundColor();
col[s][sx]=(int)n1;
mat[s][sx]=bb;
}
}
}
}
int[] white=new int[500];
int[][] point=new int[500][20];
for(s=1;s<321;s++){
artist[s]=mat[s][1];
white[s]=0;
for(sx=2;sx<44;sx++){
if(col[s][sx]==64)white[s]=white[s]+1;
if(col[s][sx]==23)white[s]=white[s]+1;
if(col[s][sx]==34)white[s]=white[s]+1;
if(s==36)System.out.println(col[s][sx]);
}
for(sx=2;sx<44;sx++){
int m=(int)num(mat[s][sx]);
point[s][m]=point[s][m]+1;
}
}
for(s=1;s<321;s++){
int n1=white[s];
for(sx=1;sx<7;sx++){
n1=n1+point[s][sx];
}
int m1=0;
for(sx=1;sx<7;sx++){
m1=m1+point[s][sx];
System.out.println(artist[s]+","+sx+","+n1+","+m1);
}
}
} catch (Exception e) {e.printStackTrace();}
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
double num(String str){
double nx;
nx=0;
try{
nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年02月17日 10:22