glens 2002/06/08 05:19:05
Modified: src/documentation/xdocs/hssf Tag: REL_1_5_BRANCH
quick-guide.xml
Log:
New example
Revision Changes Path
No revision
No revision
1.4.2.1 +30 -0 jakarta-poi/src/documentation/xdocs/hssf/quick-guide.xml
Index: quick-guide.xml
===================================================================
RCS file: /home/cvs/jakarta-poi/src/documentation/xdocs/hssf/quick-guide.xml,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- quick-guide.xml 6 Apr 2002 13:36:05 -0000 1.4
+++ quick-guide.xml 8 Jun 2002 12:19:05 -0000 1.4.2.1
@@ -28,6 +28,7 @@
<li><link href="#MergedCells">Merging cells</link></li>
<li><link href="#WorkingWithFonts">Working with
fonts</link></li>
<li><link href="#ReadWriteWorkbook">Reading and
writing</link></li>
+ <li><link href="#NewLinesInCells">Use newlines in
cells.</link></li>
</ul>
</section>
<section title="Features">
@@ -293,6 +294,35 @@
wb.write(fileOut);
fileOut.close();
</source>
+ </section>
+ <anchor id="UseNewLinesInCells"/>
+ <section title="Using newlines in cells">
+ <source>
+ 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();</source>
</section>
</section>
</section>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>