約 777,426 件
https://w.atwiki.jp/kome90kome80/pages/18.html
JavaとApache POIを使ってExcelでうさぎ観察日記を作ろう (2/6)よりーーーーーーーーーーーーーーーーーーー Excel 2007で大きな変更がありました。一番のポイントは、Excel 2007から標準のファイル形式がXML(Extensible Markup Language)に変更されたことでしょう。これに伴いExcelファイルの拡張子も、従来の「.xls」から「.xlsx」になっています。 この影響は、POIにも現れています。先ほど説明した通り、POIはExcelファイルを独自に読み込みます。そのため、読み込むファイル形式に変更があると、とても大きな影響を受けます。Excel 2007からのファイル形式の変更に伴い、POIの中身も大きく二つのコンポーネントに分けられました。「HSSF」と「XSSF」です。 HSSFはExcel 2003までの形式に対応したコンポーネントで、一方のXSSFはExcel 2007以降のXMLフォーマットに対応したコンポーネントになります。 http //itpro.nikkeibp.co.jp/article/COLUMN/20110405/359101/ ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
https://w.atwiki.jp/javadsge/pages/318.html
package poi; 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 t=new pro(); } pro(){ Workbook wb = new HSSFWorkbook(); Sheet sh = wb.createSheet(); int s,sx; Row[] row1=new Row[100]; for(s=0;s 10;s++){ row1[s] = sh.createRow(s); } Cell[][] cx=new Cell[100][100]; for(s=0;s 10;s++){ for(sx=0;sx 10;sx++){ cx[s][sx]= row1[s].createCell(sx); }} for(s=0;s 10;s++){ for(sx=0;sx 10;sx++){ cx[s][sx].setCellValue("Q"+s+"P"+sx); }} FileOutputStream out =null; try{ out = new FileOutputStream("sample.xls"); wb.write(out); }catch(IOException e){System.out.println(e.toString());} } }
https://w.atwiki.jp/government/pages/22.html
poi 麻生太郎専門のMAD作者 関連タグ 麻生太郎 マイリスト 【ニコニコ動画】作ったもの 最新作 代表作 ※アップロード者は別の人
https://w.atwiki.jp/takazumi/pages/46.html
import org.apache.poi.util.* import org.apache.poi.hssf.usermodel.* /* ブック作成 */ def book = new HSSFWorkbook() /* シート作成 */ def sheet = book.createSheet("画像挿入テスト") /* 画像をストリームで読み込む */ def bytes = IOUtils.toByteArray(new FileInputStream("./image/fumo.jpg")) def pictureIdx = book.addPicture(bytes, HSSFWorkbook.PICTURE_TYPE_JPEG) /* 描画オブジェクト生成(一回のみ実行する) */ def patriarch = sheet.createDrawingPatriarch() /* アンカーの生成 */ def anchor = new HSSFClientAnchor() // 0 = Move and size with Cells. // 2 = Move but don t size with cells. // 3 = Don t move or size with cells. anchor.setAnchorType(0) // ここではセルにあわせて移動&リサイズを選択 /* * 余白微調整? * このsetD~を指定しないとセルにぴったりくっついた感じになる */ anchor.setDx1(100) anchor.setDy1(100) anchor.setDx2(-100) anchor.setDy2(-100) /* * 画像の左上がセル(0,0)の左上~ * 右下がセル(10,3)の左上(=セル(9,2)の右下) */ anchor.setRow1(0) anchor.setCol1(0 as short) anchor.setRow2(10) anchor.setCol2(3 as short) /* partiachに画像を設定 */ patriarch.createPicture(anchor, pictureIdx) /* ファイル出力 */ book.write(new FileOutputStream("./excel/insert_image.xls"))
https://w.atwiki.jp/nicohistory/pages/43.html
poi 麻生太郎専門のMAD作者 ジャンル MAD 関連タグ 政歴M@D 麻生太郎 マイリスト 【ニコニコ動画】作ったもの 最新作 代表作 ※アップロード者は別の人
https://w.atwiki.jp/ce00582/pages/6103.html
package poi6; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; public class pro { public static void main(String[] args) { pro test=new pro(); } pro(){ try{ FileInputStream is = new FileInputStream("ren.xls"); Workbook wb = new HSSFWorkbook(is); Sheet sh = wb.getSheetAt(0); Row row = sh.getRow(0); Cell cell = row.getCell(1); String cc = cell.getStringCellValue(); System.out.println(cc); } catch (Exception e) { e.printStackTrace(); System.out.println("処理が失敗しました"); } } }
https://w.atwiki.jp/javadsge/pages/319.html
package codex; public class pro { String[] credit=new String[50]; int creditnumber; String[] code=new String[50]; String[] style=new String[50]; int[] strlong=new int[50]; String[][] v=new String[500][60]; int datanumber; public static void main(String[] args) { pro t=new pro(); } pro(){ datanumber=2; creditnumber=2; credit[1]="A"; credit[2]="B"; code[1]="4A"; code[2]="4B"; style[1]="INTEGER"; style[2]="VARCHAR"; strlong[1]=4; strlong[2]=3; int s,sx; for(s=1;s datanumber+1;s++){ for(sx=1;sx creditnumber+1;sx++){ v[s][sx]="500"; }} pre sub=new pre(); sub.datanumber=datanumber; sub.creditnumber=creditnumber; sub.credit=credit; sub.code=code; sub.style=style; sub.strlong=strlong; sub.v=v; sub.makedata("x.xls"); } } package codex; 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 pre { String[] credit=new String[50]; int creditnumber; String[] code=new String[50]; String[] style=new String[50]; int[] strlong=new int[50]; String[][] v=new String[500][60]; int datanumber; void makedata(String file){ Workbook wb = new HSSFWorkbook(); Sheet sh = wb.createSheet(); int s,sx; Row[] row=new Row[datanumber+4]; for(s=0;s datanumber+4;s++){ row[s] = sh.createRow(s); } Cell[][] cx=new Cell[datanumber+4][creditnumber]; for(s=0;s datanumber+4;s++){ for(sx=0;sx creditnumber;sx++){ cx[s][sx]= row[s].createCell(sx); }} for(sx=0;sx creditnumber;sx++){ cx[0][sx].setCellValue(credit[sx+1]); cx[1][sx].setCellValue(code[sx+1]); cx[2][sx].setCellValue(style[sx+1]); cx[3][sx].setCellValue(strlong[sx+1]); } for(s=1;s datanumber+1;s++){ for(sx=1;sx creditnumber+1;sx++){ cx[s+3][sx-1].setCellValue(v[s][sx]); }} FileOutputStream out =null; try{ out = new FileOutputStream(file); wb.write(out); }catch(IOException e){System.out.println(e.toString());} } }
https://w.atwiki.jp/enusii/pages/20.html
poiを使用したサンプル セルの値を取得するサンプル poiを使用したサンプル /** * poiを使用したサンプル */ protected boolean poiSample() { //Excelのワークブックを読み込みます。 POIFSFileSystem filein = new POIFSFileSystem(new FileInputStream("C /temp.xls")); HSSFWorkbook book = new HSSFWorkbook(filein); //シートを読み込みます。 HSSFSheet sheet = book.getSheet("sheet1"); //セルの値を取得 for (int i = ROW_START; i = sheet.getLastRowNum(); i++) { HSSFRow row = sheet.getRow(i); if(row == null){ break; } //データ取得 String cell_1 = getCellValue(row.getCell(1), true); String cell_2 = getCellValue(row.getCell(2), false); } } セルの値を取得するサンプル /** * セルの値を取得. * @param cell * @param trim_flg * @return */ public static String getCellValue(HSSFCell cell, boolean trim_flg ){ int cell_typ = cell.getCellType(); String ret = ""; //空白 if(cell_typ == HSSFCell.CELL_TYPE_BLANK){ ret = cell.getStringCellValue(); } //TODO Boolean型? else if(cell_typ == HSSFCell.CELL_TYPE_BOOLEAN ){ ret = cell.getStringCellValue(); } //TODO エラーコード? else if(cell_typ == HSSFCell.CELL_TYPE_ERROR ){ ret = cell.getStringCellValue(); } //TODO 計算式? else if(cell_typ == HSSFCell.CELL_TYPE_FORMULA ){ String tmp = String.valueOf(cell.getNumericCellValue()); if("NaN".equals(tmp)){ ret = cell.getStringCellValue(); } else{ ret = delScale(tmp); } } //数値型 else if(cell_typ == HSSFCell.CELL_TYPE_NUMERIC ){ ret = delScale(String.valueOf(cell.getNumericCellValue())); } //文字列型 else if(cell_typ == HSSFCell.CELL_TYPE_STRING ){ ret = cell.getStringCellValue(); } if(trim_flg){ if(ret.length() != 1){ ret = ret.trim(); } } return ret; } 名前 コメント
https://w.atwiki.jp/7g569d/pages/58.html
7poi0t twitpicコメント: @stretchmanbot auzen stretchmanbot 概要 製作者 auzen 投稿日時 派生元 ?page=%40stretchmanbot @stretchmanbot
https://w.atwiki.jp/ce00582/pages/846.html
Function tls(th, y) As Single Dim n As Single Dim m As Single Dim tl As Single Dim tr As Single Dim c(0 To 100) As Single Dim maxw As Single Dim maxtl As Single Dim w1 As Single maxw = -999 For n = 1 To 60 tl = 0.01 * n tr = trs(tl, th, y) For m = 0 To 100 c(m) = (1 - tl) * y(m) + tr Next w1 = wel(th, c, y) If w1 maxw Then maxtl = tl If w1 maxw Then maxw = w1 Next tls = maxtl End Function Function trs(tl As Single, th, y) As Single Dim m As Single Dim tr1 As Single Dim tr2 As Single Dim tr3 As Single Dim b1 As Single Dim b2 As Single Dim b3 As Single Dim c(0 To 100) As Single Dim t As Single tr1 = 0.01 For m = 0 To 100 c(m) = (1 - tl) * y(m) + tr1 Next b1 = bud(th, c, y) tr2 = 0.5 For m = 0 To 10 c(m) = (1 - tl) * y(m) + tr2 Next b2 = bud(th, c, y) t = 0 Do Until t 100 tr3 = (tr1 + tr2) / 2 For m = 0 To 10 c(m) = (1 - tl) * y(m) + tr3 Next b3 = bud(th, c, y) If b3 0 Then b1 = b3 If b3 0 Then tr1 = tr3 If b3 0 Then b2 = b3 If b3 0 Then tr2 = tr3 If b3 ^ 2 10 ^ (-5) Then t = 1000 t = t + 1 Loop trs = tr1 End Function Function bud(th, c, y) As Single Dim b1 As Single Dim s As Single Dim m As Single b1 = 0 For s = 1 To 100 m = prefer(s, th, c, y) b1 = b1 + y(m) - c(m) Next bud = b1 End Function Function wel(th, c, y) As Single Dim w1 As Single Dim s As Single Dim m As Single w1 = 0 For s = 1 To 100 m = prefer(s, th, c, y) w1 = w1 + Log(c(m)) + Log(1 - y(m) / th(s)) Next wel = w1 End Function Function prefer(s As Single, th, c, y) As Single Dim m As Single Dim maxu As Single Dim maxm As Single Dim u1 As Single Dim c1 As Single Dim l1 As Single maxu = -999 For m = 0 To 100 c1 = c(m) l1 = y(m) / th(s) pp = 0 If l1 0.99 Then pp = 1 If l1 0.99 Then l1 = 0.5 If c1 0.01 Then pp = 1 If c1 0.01 Then c1 = 0.5 u1 = Log(c1) + Log(1 - l1) If pp = 1 Then u1 = -999 If u1 maxu Then maxm = m If u1 maxu Then maxu = u1 Next prefer = maxm End Function Private Sub Command1_Click() Dim s As Single Dim m As Single Dim th(1 To 100) As Single Dim y(0 To 100) As Single Dim c(0 To 100) As Single Dim tl As Single Dim tr As Single For s = 1 To 100 th(s) = 0.02 * s Next For m = 0 To 100 y(m) = 0.01 * m Next tl = tls(th, y) tr = trs(tl, th, y) Debug.Print tl, tr For m = 0 To 100 c(m) = (1 - tl) * y(m) + tr Next Open "c /41.txt" For Output As #1 For m = 0 To 100 Write #1, m, y(m), c(m) Next Close #1 End Sub