POI

POI api Projects

POI api Project 1

Set page numbers on the footer of a sheet using POI
Previous Home Next

 

In this page of the example we are going to show you how we are set the page number at footer or header. for performing this action POI provide the special function setRight( "Page " + HeaderFooter.page() + " of " + HeaderFooter.numPages() ); .


 getFooter() It is used to get the footer of the sheet.
setRight( "Page " + HeaderFooter.page() + " of " + HeaderFooter.numPages() ) It is used to set the footer number on the page.


 

Workbook wkb =
new HSSFWorkbook(); Sheet sit = wkb.createSheet("format sheet"); Footer ft = sit.getFooter(); ft.setRight( "Page " + HeaderFooter.page() + " of " + HeaderFooter.numPages() ); // Create various cells and rows. FileOutputStream fOut = new FileOutputStream("workbook.xls"); wkb.write(fOut); fOut.close();

 


Previous Home Next