|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.hssf.usermodel.HSSFWorkbook
High level representation of a workbook. This is the first object most users will construct whether they are reading or writing a workbook. It is also the top level object for creating new sheets/etc.
Workbook
,
HSSFSheet
Field Summary | |
static byte |
ENCODING_COMPRESSED_UNICODE
|
static byte |
ENCODING_UTF_16
|
static int |
INITIAL_CAPACITY
used for compile-time performance/memory optimization. |
Constructor Summary | |
HSSFWorkbook()
Creates new HSSFWorkbook from scratch (start here!) |
|
HSSFWorkbook(java.io.InputStream s)
|
|
HSSFWorkbook(java.io.InputStream s,
boolean preserveNodes)
Companion to HSSFWorkbook(POIFSFileSystem), this constructs the POI filesystem around your inputstream. |
|
HSSFWorkbook(POIFSFileSystem fs)
|
|
HSSFWorkbook(POIFSFileSystem fs,
boolean preserveNodes)
given a POI POIFSFileSystem object, read in its Workbook and populate the high and low level models. |
Method Summary | |
int |
addSSTString(java.lang.String string)
|
HSSFSheet |
cloneSheet(int sheetNum)
create an HSSFSheet from an existing sheet in the HSSFWorkbook. |
HSSFCellStyle |
createCellStyle()
create a new Cell style and add it to the workbook's style table |
HSSFDataFormat |
createDataFormat()
Creates an instance of HSSFDataFormat. |
HSSFFont |
createFont()
create a new Font and add it to the workbook's font table |
HSSFName |
createName()
creates a new named range and add it to the model |
HSSFSheet |
createSheet()
create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation. |
HSSFSheet |
createSheet(java.lang.String sheetname)
create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation. |
boolean |
getBackupFlag()
determine whether the Excel GUI will backup the workbook when saving. |
byte[] |
getBytes()
Method getBytes - get the bytes of just the HSSF portions of the XLS file. |
HSSFCellStyle |
getCellStyleAt(short idx)
get the cell style object at the given index |
HSSFPalette |
getCustomPalette()
|
HSSFFont |
getFontAt(short idx)
get the font at the given index number |
HSSFName |
getNameAt(int index)
gets the Named range |
int |
getNameIndex(java.lang.String name)
gets the named range index by his name |
java.lang.String |
getNameName(int index)
gets the named range name |
short |
getNumberOfFonts()
get the number of fonts in the font table |
int |
getNumberOfNames()
gets the total number of named ranges in the workboko |
int |
getNumberOfSheets()
get the number of spreadsheets in the workbook (this will be three after serialization) |
short |
getNumCellStyles()
get the number of styles the workbook contains |
HSSFSheet |
getSheet(java.lang.String name)
Get sheet with the given name |
HSSFSheet |
getSheetAt(int index)
Get the HSSFSheet object at the given index. |
int |
getSheetIndex(java.lang.String name)
Returns the index of the sheet by his name |
java.lang.String |
getSheetName(int sheet)
get the sheet name |
java.lang.String |
getSSTString(int index)
|
void |
insertChartRecord()
|
void |
removeName(int index)
remove the named range by his index |
void |
removeName(java.lang.String name)
remove the named range by his name |
void |
removeSheetAt(int index)
removes sheet at the given index |
void |
setBackupFlag(boolean backupValue)
determine whether the Excel GUI will backup the workbook when saving. |
void |
setRepeatingRowsAndColumns(int sheetIndex,
int startColumn,
int endColumn,
int startRow,
int endRow)
Sets the repeating rows and columns for a sheet (as found in File->PageSetup->Sheet). |
void |
setSheetName(int sheet,
java.lang.String name)
set the sheet name. |
void |
setSheetName(int sheet,
java.lang.String name,
short encoding)
|
void |
write(java.io.OutputStream stream)
Method write - write out this workbook to an Outputstream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INITIAL_CAPACITY
public static final byte ENCODING_COMPRESSED_UNICODE
public static final byte ENCODING_UTF_16
Constructor Detail |
public HSSFWorkbook()
public HSSFWorkbook(POIFSFileSystem fs) throws java.io.IOException
public HSSFWorkbook(POIFSFileSystem fs, boolean preserveNodes) throws java.io.IOException
fs
- the POI filesystem that contains the Workbook stream.preserveNodes
- whether to preseve other nodes, such as
macros. This takes more memory, so only say yes if you
need to.
java.io.IOException
- if the stream cannot be readPOIFSFileSystem
public HSSFWorkbook(java.io.InputStream s) throws java.io.IOException
public HSSFWorkbook(java.io.InputStream s, boolean preserveNodes) throws java.io.IOException
s
- the POI filesystem that contains the Workbook stream.preserveNodes
- whether to preseve other nodes, such as
macros. This takes more memory, so only say yes if you
need to.
java.io.IOException
- if the stream cannot be readPOIFSFileSystem
,
HSSFWorkbook(POIFSFileSystem)
Method Detail |
public void setSheetName(int sheet, java.lang.String name)
sheet
- number (0 based)public void setSheetName(int sheet, java.lang.String name, short encoding)
public java.lang.String getSheetName(int sheet)
sheet
- Number
public int getSheetIndex(java.lang.String name)
name
- the sheet name
public HSSFSheet createSheet()
public HSSFSheet cloneSheet(int sheetNum)
public HSSFSheet createSheet(java.lang.String sheetname)
sheetname
- sheetname to set for the sheet.
public int getNumberOfSheets()
public HSSFSheet getSheetAt(int index)
index
- of the sheet number (0-based physical & logical)
public HSSFSheet getSheet(java.lang.String name)
name
- of the sheet
public void removeSheetAt(int index)
index
- of the sheet (0-based)public void setBackupFlag(boolean backupValue)
backupValue
- true to indicate a backup will be performed.public boolean getBackupFlag()
public void setRepeatingRowsAndColumns(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow)
To set just repeating columns:
workbook.setRepeatingRowsAndColumns(0,0,1,-1-1);To set just repeating rows:
workbook.setRepeatingRowsAndColumns(0,-1,-1,0,4);To remove all repeating rows and columns for a sheet.
workbook.setRepeatingRowsAndColumns(0,-1,-1,-1,-1);
sheetIndex
- 0 based index to sheet.startColumn
- 0 based start of repeating columns.endColumn
- 0 based end of repeating columns.startRow
- 0 based start of repeating rows.endRow
- 0 based end of repeating rows.public HSSFFont createFont()
public short getNumberOfFonts()
public HSSFFont getFontAt(short idx)
idx
- index number
public HSSFCellStyle createCellStyle()
public short getNumCellStyles()
public HSSFCellStyle getCellStyleAt(short idx)
idx
- index within the set of styles
public void write(java.io.OutputStream stream) throws java.io.IOException
stream
- - the java OutputStream you wish to write the XLS to
java.io.IOException
- if anything can't be written.POIFSFileSystem
public byte[] getBytes()
Workbook
,
Sheet
public int addSSTString(java.lang.String string)
public java.lang.String getSSTString(int index)
public int getNumberOfNames()
public HSSFName getNameAt(int index)
index
- position of the named range
public java.lang.String getNameName(int index)
index
- the named range index (0 based)
public HSSFName createName()
public int getNameIndex(java.lang.String name)
name
- named range name
public void removeName(int index)
index
- named range index (0 based)public HSSFDataFormat createDataFormat()
FormatRecord
,
Record
public void removeName(java.lang.String name)
name
- named range namepublic HSSFPalette getCustomPalette()
public void insertChartRecord()
|
jakarta-poi 1.10.0-dev | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |