Nidhi, Thanks for a detailed reply. When I set wrapText to true, doesn't it automatically format the text with new lines? In other words do I have to explicitly format the text by inserting new lines?
Thanks again, -M Nidhi Tuli <[EMAIL PROTECTED]> wrote: You can look at http://jakarta.apache.org/poi/hssf/quick-guide.html Using newlines in cells HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet s = wb.createSheet(); HSSFRow r = null; HSSFCell c = null; HSSFCellStyle cs = wb.createCellStyle(); HSSFFont f = wb.createFont(); HSSFFont f2 = wb.createFont(); cs = wb.createCellStyle(); cs.setFont( f2 ); //Word Wrap MUST be turned on cs.setWrapText( true ); r = s.createRow( (short) 2 ); r.setHeight( (short) 0x349 ); c = r.createCell( (short) 2 ); c.setCellType( HSSFCell.CELL_TYPE_STRING ); c.setCellValue( "Use \n with word wrap on to create a new line" ); c.setCellStyle( cs ); s.setColumnWidth( (short) 2, (short) ( ( 50 * 8 ) / ( (double) 1 / 20 ) ) ); FileOutputStream fileOut = new FileOutputStream( "workbook.xls" ); wb.write( fileOut ); fileOut.close(); Hope this helps Nidhi -----Original Message----- From: Meghana [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 3:40 PM To: [email protected] Subject: Multi line text Hi, Does any one know how to out put the text in multiple lines in a cell? In each row only two cells will have large text running into multiple lines. Any help is appreciated, Thanks, -M __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
