Quantcast
Channel: 質問!ITmedia 新着質問(Java/253)
Viewing all articles
Browse latest Browse all 2439

java ApachePOIについて

$
0
0
サーブレットとApachePOIについて質問です。 下記のソースで書き込んだセルをすべて黄色で塗りつぶしをしたいのですが、 ソースの書き方を教えてください。 自力で下のように書いたのですが、だめでした。。。。 以上、お願いします。 「ソース」 // 業務名前 String[] name4 = request.getParameterValues("gyoumuname"); for (int i = 0; i < name4.length; i++) { System.out.println(i + " " + name4[i]); name4[i] = new String(name4[i].getBytes("8859_1"), "UTF-8"); List outList=new ArrayList(); for (int i = 0; i < name4.length; i++) { outList.add(name4[i]); } for (int i = 0; i < outList.size(); i++) { Row row5 = sheet.getRow(8 + i); row5.getCell(3).setCellValue(new HSSFRichTextString(outList.get(i).toString())); } for (int i = 0; i < name4.length; i++) { HSSFCellStyle style = workbook.createCellStyle(); style.setFillForegroundColor(HSSFColor.YELLOW.index); //黄色 style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); //塗り潰し } FileOutputStream out = null; try { out = new FileOutputStream( "C:\\Users\\satou\\Desktop\\weekreport.xls"); workbook.write(out); } catch (IOException e) { System.out.println(e.toString()); } finally { try { out.close(); } catch (IOException e) { System.out.println(e.toString()); } } 以下省略。

Viewing all articles
Browse latest Browse all 2439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>