アットウィキロゴ

package html;
 
import java.io.*;
 
public class pro {
 
    int maxx,maxy;
 
    String[][] mat=new String[500][500]; 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
 
    pro(){
 
    count sub=new count();
    sub.supx=500;
    sub.makedata("data.xls",1);
    maxx=sub.maxx;
    maxy=sub.maxy;
 
 
 
    readxls sub2=new readxls();
    sub2.maxx=maxx;
    sub2.maxy=maxy;
    sub2.makedata("data2.xls",3);
    mat=sub2.mat;
 
 
 
writehtml("ren.html");  
 
 
 
 
    }
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 html;
 
 
import java.io.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
 
public class count {
 
    int supx;
 
    int maxx,maxy;
   Cell cc;
   String[][] mat=new String[50000][50]; 
 
 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,h;
      String bb;
 
 
      int mode;
 
 s=0;
 mode=0;
  while(mode<50){
  s=s+1;
 Row row = sh.getRow(s-1);
  j=0;
  if(row==null)j=100;
  if(j>50)mode=100;
  if(j<60)maxy=s;
  }
 
 
 int x1;
 
 for(s=1;s<maxy+1;s++){
 Row row2 = sh.getRow(s-1);
 x1=0;
 mode=0;  
 for(sx=1;sx<supx;sx++){
 cc = row2.getCell(sx-1);
 j=0;
 if(cc==null)j=100;
 if(j>60)mode=100;
 if(j<60)x1=sx;
 if(x1>maxx)maxx=x1;
 }
 }
 
 
 
 
 
 
 
  } catch (Exception e) {e.printStackTrace();}
 
 
 
 
 
 
 
 }
}
 
最終更新:2014年04月22日 15:20