アットウィキロゴ

ぺあr

package peach;
 
import java.io.*;
 
public class pro {
   int maxx,maxy;
   String[][] mat=new String[5000][5000]; 
   int fastline,lastline;
   int creditline;
   int creditx,credity;
    String[] index=new String[500];
     String[] credit=new String[500];
   String memo;
 
 
    public static void main(String[] args) {
       pro t=new pro();
    }
    pro(){
 
        maxx=20;
        maxy=100;
 
        int tr;
        for(tr=1;tr<60;tr++){
 
         readxls sub=new readxls();
       sub.maxx=maxx;
       sub.maxy=maxy;
       sub.makedata("data/"+tr+".xls",0);
   mat=sub.mat;
 
 
      writehtml("ren.html");
 
   int s;
   fastline=0;
      for(s=1;s<21;s++){
      int h=0;
      if(mat[s][1].indexOf("(")>-1)h=h+1;
      if(fastline==0)h=h+1;
      if(h==2)fastline=s;
 
      }  
 
      lastline=0;
      for(s=1;s<90;s++){
      int h=0;
      if(mat[s][1].indexOf("(")>-1)lastline=s;
      }  
 
       System.out.println(fastline);    
        System.out.println(lastline);   
 
 
        memo=mat[4][1];
 
        writexml("gdata/"+tr+".txt");
 
        }
 
    }
 
        void writexml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=fastline;s<lastline+1;s++){   
pw.print(memo); 
pw.print(",");    
pw.print(mat[s][1]); 
pw.print(",");
pw.print(mat[s][2]); 
pw.print(",");
pw.print(mat[s][3]); 
pw.print(",");
pw.println(mat[s][4]); 
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
      void writehtml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
 
pw.println("<html>");
 
pw.println("<head>");
pw.println("<meta charset=\"UTF-8\">");
pw.println("</head>");
pw.println("<body>");
pw.print("<table rules=\"all\">"); 
pw.print("<tr>"); 
pw.print("<td>"); 
pw.print(""); 
pw.print("</td>"); 
for(sx=1;sx<maxx+1;sx++){ 
pw.print("<th>"); 
pw.print(sx); 
pw.print("</th>"); 
} 
pw.println("</tr>"); 
for(s=1;s<maxy+1;s++){ 
pw.print("<tr>"); 
pw.print("<th>"); 
pw.print(s); 
pw.print("</th>"); 
for(sx=1;sx<maxx+1;sx++){ 
pw.print("<td>"); 
pw.print(mat[s][sx]); 
pw.print("</td>"); 
} 
pw.println("</tr>"); 
}   
pw.println("</table>"); 
pw.println("</body>");
pw.println("</html>");
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
}
 
 
 
package peach;
 
import java.io.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
 
 
public class readxls {
 
    int maxx,maxy;
   Cell cc;
   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,hh;
      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);
  hh=0;
  if(cc==null)hh=100;
  if(hh<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年07月05日 01:59