Home

XSSFSheet

XSSFSheet is a class in the Apache POI library that represents a single worksheet within an XSSF workbook, the implementation POI uses for the OOXML-based .xlsx format. It is the XSSF-specific counterpart to the HSSFSheet class used for .xls files. XSSFSheet implements the Sheet interface and is typically accessed through an XSSFWorkbook. A sheet contains rows, which in turn contain cells, and it provides mechanisms to create, retrieve, and remove these rows and cells, as well as to manage sheet-wide properties such as column widths, merged regions, and print settings.

Common usage patterns involve creating a workbook, adding a sheet with workbook.createSheet("Name"), then creating rows with

Under the hood, XSSFSheet delegates to XSSFRow and XSSFCell, which map to the underlying OOXML structures (such

Compared with HSSFSheet, XSSFSheet targets the newer XLSX format and supports larger data capacity and OOXML-specific

sheet.createRow(0)
and
cells
with
row.createCell(0).
Values
are
assigned
via
cell.setCellValue(...)
with
support
for
numeric,
string,
boolean,
and
date
types.
Styles
can
be
applied
using
cell.setCellStyle(...).
The
sheet
supports
operations
like
merging
regions
with
addMergedRegion(CellRangeAddress)
and
querying
or
enumerating
merged
regions.
Other
typical
operations
include
retrieving
rows
with
getRow(int)
and
iterating
through
rows
and
cells.
as
CTWorksheet
and
related
XML
components).
Changes
to
a
sheet
are
held
in
memory
and
only
written
to
the
underlying
.xlsx
file
when
the
workbook
is
written.
This
class
is
designed
for
use
within
the
single-process
lifecycle
of
constructing
or
modifying
an
in-memory
workbook
before
writing
it
out.
styling.
It
is
generally
intended
to
be
used
in
a
single-threaded
context
or
with
proper
synchronization
during
construction
of
the
workbook.