make header and footer and attache it with excel sheet.
In this example we make header and footer and attaché
it with excel sheet.
Code description
The package we need to import is java.io.*,java.util.*,org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.
HSSFCellStyle,
org.apache.poi.hssf.usermodel.HSSFCell,org.apache.poi.hssf.usermodel.HSSFRow,org.apache.hssf.util.
Region,
org.apache. poi.hssf.usermodel.HSSFFooter and
org.apache.poi.hssf.usermodel. HSSFWorkbook.
The org.apache. poi.hssf.usermodel.HSSFFooter class is used to
create the header and footer. We create the object of header and footer and page
it on sheet.
The method used in this example shift row
getFooter():
This method is used to gets the user model for the document footer.
getHeader()
his method is used to gets the user model for the document header.
setRight():
This method is used to set string (e.g.Header and Footer) right.
page()::
This method returns the the page .
numPage():
This method is used to return number of page.
In this example we are craeting the sheet and set the header and footer .The
header and footer can display you on page at the time of taking print out.So we
are not giving any output here. But you can download the code and check the
output.
The code of the program is given below:
<%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
|