EXCELファイル セル内の文字の改行 [ POI 3.0 ] †
> String tmp = System.getProperty("java.io.tmpdir");
> if (tmp.charAt(tmp.length()-1) != '/')
> tmp = tmp+"/";
> String filename = tmp + "test.xls";
>
> HSSFWorkbook wb = new HSSFWorkbook();
> HSSFSheet sheet = wb.createSheet();
>
> HSSFRow row = sheet.createRow(1);
> HSSFCell cell = row.createCell((short)1);
>
> HSSFCellStyle style = wb.createCellStyle();
> //改行OK
> style.setWrapText(true);
> cell.setCellStyle(style);
> row.setHeight((short)(row.getHeight()*2));
> HSSFRichTextString rtext = new HSSFRichTextString("改行\nテスト");
> cell.setCellValue(rtext);
>
> FileOutputStream out = null;
> try {
> out = new FileOutputStream(filename);
> wb.write(out);
> }
> catch(IOException e) {
> e.printStackTrace();
> }
> finally{
> try {
> out.close();
> }catch(IOException e){
> e.printStackTrace();
> }
> }
最新の20件
2010-01-26
2010-05-09
2010-02-04
- Src001 EXCELファイル セル内の文字の改行
2010-05-09
2010-01-27
2010-01-26
2010-09-10
2010-07-04
2010-05-10
2010-01-26
今日の7件
- counter: 654
- today: 1
- yesterday: 0
- online: 1