PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7b2c9fb69
commit
0c8abbbec4
@ -30,6 +30,8 @@
|
|||||||
<li><link href="#ReadWriteWorkbook">Reading and writing</link></li>
|
<li><link href="#ReadWriteWorkbook">Reading and writing</link></li>
|
||||||
<li><link href="#NewLinesInCells">Use newlines in cells.</link></li>
|
<li><link href="#NewLinesInCells">Use newlines in cells.</link></li>
|
||||||
<li><link href="#DataFormats">Create user defined data formats.</link></li>
|
<li><link href="#DataFormats">Create user defined data formats.</link></li>
|
||||||
|
<li><link href="#PrintArea">Set print area for a sheet.</link></li>
|
||||||
|
<li><link href="#FooterPageNumbers">Set page numbers on the footer of a sheet.</link></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<section title="Features">
|
<section title="Features">
|
||||||
@ -356,6 +358,45 @@
|
|||||||
fileOut.close();
|
fileOut.close();
|
||||||
</source>
|
</source>
|
||||||
</section>
|
</section>
|
||||||
|
<anchor id="PrintArea"/>
|
||||||
|
<section title="Set Print Area to One Page">
|
||||||
|
<source>
|
||||||
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
HSSFSheet sheet = wb.createSheet("format sheet");
|
||||||
|
HSSFPrintSetup ps = sheet.getPrintSetup()
|
||||||
|
|
||||||
|
sheet.setAutobreaks(true)
|
||||||
|
|
||||||
|
ps.setFitHeight((short)1);
|
||||||
|
ps.setFitWidth((short)1);
|
||||||
|
|
||||||
|
|
||||||
|
// Create various cells and rows for spreadsheet.
|
||||||
|
|
||||||
|
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||||
|
wb.write(fileOut);
|
||||||
|
fileOut.close();
|
||||||
|
</source>
|
||||||
|
</section>
|
||||||
|
<anchor id="FooterPageNumbers"/>
|
||||||
|
<section title="Set Page Numbers on Footer">
|
||||||
|
<source>
|
||||||
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
HSSFSheet sheet = wb.createSheet("format sheet");
|
||||||
|
HSSFFooter footer = sheet.getFooter()
|
||||||
|
|
||||||
|
footer.setRight( "Page " + HSSFFooter.page() + " of " + HSSFFooter.numPages() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Create various cells and rows for spreadsheet.
|
||||||
|
|
||||||
|
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||||
|
wb.write(fileOut);
|
||||||
|
fileOut.close();
|
||||||
|
</source>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user