Src001 EXCELファイル セル内の文字の改行


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();		
>	    }		
>	}