0% found this document useful (0 votes)
156 views4 pages

Xssfsheet

The document discusses the HSSFWorkbook and XSSFWorkbook classes used to represent Excel workbooks in different file formats. It notes that HSSFWorkbook is only compatible with the older xls format, so the focus is on XSSFWorkbook which can represent both older and newer Excel file formats. Details about the constructors and methods of the XSSFWorkbook and XSSFSheet classes are then provided.

Uploaded by

anand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views4 pages

Xssfsheet

The document discusses the HSSFWorkbook and XSSFWorkbook classes used to represent Excel workbooks in different file formats. It notes that HSSFWorkbook is only compatible with the older xls format, so the focus is on XSSFWorkbook which can represent both older and newer Excel file formats. Details about the constructors and methods of the XSSFWorkbook and XSSFSheet classes are then provided.

Uploaded by

anand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

The HSSFWorkbook class contains a number of methods; however they are

compatible with xls format only. In this tutorial, the focus is on the latest
version of Excel file formats. Hence, the class methods of HSSFWorkbook
are not listed here. If you require these class methods, then refer POIHSSFWorkbook
class
API
athttps://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFWork
book.html.

XSSFWorkbook
It is a class that is used to represent both high and low level Excel file
formats. It belongs to the org.apache.xssf.usemodel package and
implements the Workbook interface. Listed below are the methods and
constructors under this class.

Class Constructors
S.No
.

Constructor and Description

1
XSSFWorkbook()
Creates a new XSSFworkbook object from scratch.

2
XSSFWorkbook(java.io.File file)
Constructs an XSSFWorkbook object from a given file.

3
XSSFWorkbook(java.io.InputStream is)
Constructs an XSSFWorkbook object, by buffering the whole input stream
into memory and then opening an OPCPackage object for it.

4
XSSFWorkbook(java.lang.String path)
Constructs an XSSFWorkbook object given the full path of a file.

Class Methods
S.No
.

Method and Description

1
createSheet()
Creates an XSSFSheet for this workbook, adds it to the sheets, and
returns the high level representation.

2
createSheet(java.lang.String sheetname)
Creates a new sheet for this Workbook and returns the high level
representation.

3
createFont()
Creates a new font and adds it to the workbook's font table.

4
createCellStyle()
Creates a new XSSFCellStyle and adds it to the workbook's style table.

5
createFont()

Creates a new font and adds it to the workbook's font table.

6
setPrintArea(int sheetIndex, int startColumn, int endColumn, int
startRow,int endRow)
Sets the print area of a given sheet as per the specified parameters.

For the remaining methods of this class, refer the complete API document
at:http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWork
book.html.for the complete list of methods.

Sheet
Sheet is an interface under the org.apache.poi.ss.usermodel package and it
is a super-interface of all classes that create high or low level spreadsheets
with specific names. The most common type of spreadsheet is worksheet,
which is represented as a grid of cells.

HSSFSheet
This is a class under the org.apache.poi.hssf.usermodel package. It can
create excel spreadsheets and it allows to format the sheet style and sheet
data.

Class Constructors
S.No
.

Constructor and Description

1
HSSFSheet(HSSFWorkbook workbook)

Creates new HSSFSheet called by HSSFWorkbook to create a sheet from


scratch.

2
HSSFSheet(HSSFWorkbook workbook, InternalSheet sheet)
Creates an HSSFSheet representing the given sheet object.

XSSFSheet
This is a class which represents high level representation of excel
spreadsheet. It is under org.apache.poi.hssf.usermodel package.

Class Constructors
S.No
.

Constructor and Description

1
XSSFSheet()
Creates new XSSFSheet - called by XSSFWorkbook to create a sheet from
scratch.

2
XSSFSheet(PackagePart part, PackageRelationship rel)
Creates

an

relationship.

XSSFSheet

representing

the

given

package

part

and

You might also like