Lines 30-35
Link Here
|
30 |
<li><link href="#ReadWriteWorkbook">Reading and writing</link></li> |
30 |
<li><link href="#ReadWriteWorkbook">Reading and writing</link></li> |
31 |
<li><link href="#NewLinesInCells">Use newlines in cells.</link></li> |
31 |
<li><link href="#NewLinesInCells">Use newlines in cells.</link></li> |
32 |
<li><link href="#DataFormats">Create user defined data formats.</link></li> |
32 |
<li><link href="#DataFormats">Create user defined data formats.</link></li> |
|
|
33 |
<li><link href="#PrintArea">Set print area for a sheet.</link></li> |
34 |
<li><link href="#FooterPageNumbers">Set page numbers on the footer of a sheet.</link></li> |
33 |
</ul> |
35 |
</ul> |
34 |
</section> |
36 |
</section> |
35 |
<section title="Features"> |
37 |
<section title="Features"> |
Lines 356-361
Link Here
|
356 |
fileOut.close(); |
358 |
fileOut.close(); |
357 |
</source> |
359 |
</source> |
358 |
</section> |
360 |
</section> |
|
|
361 |
<anchor id="PrintArea"/> |
362 |
<section title="Set Print Area to One Page"> |
363 |
<source> |
364 |
HSSFWorkbook wb = new HSSFWorkbook(); |
365 |
HSSFSheet sheet = wb.createSheet("format sheet"); |
366 |
HSSFPrintSetup ps = sheet.getPrintSetup() |
367 |
|
368 |
sheet.setAutobreaks(true) |
369 |
|
370 |
ps.setFitHeight((short)1); |
371 |
ps.setFitWidth((short)1); |
372 |
|
373 |
|
374 |
// Create various cells and rows for spreadsheet. |
375 |
|
376 |
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); |
377 |
wb.write(fileOut); |
378 |
fileOut.close(); |
379 |
</source> |
380 |
</section> |
381 |
<anchor id="FooterPageNumbers"/> |
382 |
<section title="Set Page Numbers on Footer"> |
383 |
<source> |
384 |
HSSFWorkbook wb = new HSSFWorkbook(); |
385 |
HSSFSheet sheet = wb.createSheet("format sheet"); |
386 |
HSSFFooter footer = sheet.getFooter() |
387 |
|
388 |
footer.setRight( "Page " + HSSFFooter.page() + " of " + HSSFFooter.numPages() ); |
389 |
|
390 |
|
391 |
|
392 |
// Create various cells and rows for spreadsheet. |
393 |
|
394 |
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); |
395 |
wb.write(fileOut); |
396 |
fileOut.close(); |
397 |
</source> |
398 |
</section> |
399 |
|
359 |
|
400 |
|
360 |
</section> |
401 |
</section> |
361 |
</section> |
402 |
</section> |