<li><link href="#CreateCells">How to create cells</link></li>
<li><link href="#CreateDateCells">How to create date cells</link></li>
<li><link href="#CellTypes">Working with different types of cells</link></li>
+ <li><link href="#Iterator">Iterate over rows and cells</link></li>
<li><link href="#TextExtraction">Text Extraction</link></li>
<li><link href="#Alignment">Aligning cells</link></li>
<li><link href="#Borders">Working with borders</link></li>
fileOut.close();
</source>
</section>
+ <anchor id="Iterator"/>
+ <section><title>Iterate over rows and cells (including Java 5 foreach loops)</title>
+ <p>Sometimes, you'd like to just iterate over all the rows in
+ a sheet, or all the cells in a row. If you are using Java
+ 5 or later, then this is especially handy, as it'll allow the
+ new foreach loop support to work.</p>
+ <p>Luckily, this is very easy. HSSFRow defines a
+ <em>CellIterator</em> inner class to handle iterating over
+ the cells (get one with a call to <em>row.cellIterator()</em>),
+ and HSSFSheet provides a <em>rowIterator()</em> method to
+ give an iterator over all the rows.</p>
+ <source>
+ HSSFSheet sheet = wb.getSheetAt(0);
+ for (HSSFRow row : sheet.rowIterator()) {
+ for (HSSFCell cell : row.cellIterator()) {
+ // Do something here
+ }
+ }
+ </source>
+ </section>
<anchor id="TextExtraction"/>
<section><title>Text Extraction</title>
<p>For most text extraction requirements, the standard