アットウィキロゴ

ex8

package excel;
 
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
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 {
    public static void main(String[] args) {
        pro y=new pro();
    }
 
    pro(){
 
       Workbook wb = new HSSFWorkbook();
Sheet sheet1 = wb.createSheet();
    Sheet sheet2 = wb.createSheet();
    Sheet sheet3 = wb.createSheet("new sheet");
    Sheet sheet4 = wb.createSheet("表計算用");
 
    Row[] row=new Row[101];
 
    int s;
 
    for(s=0;s<100;s++){
    row[s]= sheet1.createRow(s);
    }
 
    Cell[][] cx=new Cell[101][101]; 
 
    int sx;
 
     for(s=0;s<100;s++){
    for(sx=0;sx<100;sx++){
    cx[s][sx]=row[s].createCell(sx);
    }}
 
 
    for(s=0;s<100;s++){
    for(sx=0;sx<100;sx++){
    cx[s][sx].setCellValue("Hello");
    }}  
 
 
 
 
    FileOutputStream out =null;
 
    try{
 
 
        out = new FileOutputStream("sample.xls");
 
 
 
      wb.write(out);
    }catch(IOException e){}
 
 
 
 
 
 
    }
 
 
 
 
 
 
 
}
 
最終更新:2015年04月21日 14:57