Methods inherited from class java.lang.Object

Field Detail

INITIAL_CAPACITY

public static final int INITIAL_CAPACITY

used for compile-time performance/memory optimization. This determines the
initial capacity for the sheet collection. Its currently set to 3.
Changing it in this release will decrease performance
since you're never allowed to have more or less than three sheets!

setMissingCellPolicy

Sets the policy on what to do when
getting missing or blank cells from a row.
This will then apply to all calls to
HSSFRow.getCell(int)}. See
Row.MissingCellPolicy.
Note that this has no effect on any
iterators, only on when fetching Cells
by their column index.

getActiveSheetIndex

public int getActiveSheetIndex()

gets the tab whose data is actually seen when the sheet is opened.
This may be different from the "selected sheet" since excel seems to
allow you to show the data of one sheet when another is seen "selected"
in the tabs (at the bottom).

createSheet

Create a new sheet for this Workbook and return the high level representation.
Use this to create new sheets.

Note that Excel allows sheet names up to 31 chars in length but other applications
(such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars,
others - truncate such names to 31 character.

Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated
assert 31 == sheet.getSheetName().length();
assert "My very long sheet name which i" == sheet.getSheetName();

Except the 31-character constraint, Excel applies some other rules:

Sheet name MUST be unique in the workbook and MUST NOT contain the any of the following characters:

removeSheetAt

public void removeSheetAt(int index)

Removes sheet at the given index.

Care must be taken if the removed sheet is the currently active or only selected sheet in
the workbook. There are a few situations when Excel must have a selection and/or active
sheet. (For example when printing - see Bug 40414).
This method makes sure that if the removed sheet was active, another sheet will become
active in its place. Furthermore, if the removed sheet was the only selected sheet, another
sheet will become selected. The newly active/selected sheet will have the same index, or
one less if the removed sheet was the last in the workbook.

Sets the repeating rows and columns for a sheet (as found in
2003:File->PageSetup->Sheet, 2007:Page Layout->Print Titles).
This is function is included in the workbook
because it creates/modifies name records which are stored at the
workbook level.

linkExternalWorkbook

Adds the LinkTable records required to allow formulas referencing
the specified external workbook to be added to this one. Allows
formulas such as "[MyOtherWorkbook]Sheet3!$A$5" to be added to the
file, for workbooks not already referenced.

addToolPack

setForceFormulaRecalculation

public void setForceFormulaRecalculation(boolean value)

Whether the application shall perform a full recalculation when the workbook is opened.

Typically you want to force formula recalculation when you modify cell formulas or values
of a workbook previously created by Excel. When set to true, this flag will tell Excel
that it needs to recalculate all formulas in the workbook the next time the file is opened.

Note, that recalculation updates cached formula results and, thus, modifies the workbook.
Depending on the version, Excel may prompt you with "Do you want to save the changes in filename?"
on close.

changeExternalReference

Changes an external referenced file to another file.
A formula in Excel which references a cell in another file is saved in two parts:
The referenced file is stored in an reference table. the row/cell information is saved separate.
This method invocation will only change the reference in the lookup-table itself.

Parameters:

oldUrl - The old URL to search for and which is to be replaced

newUrl - The URL replacement

Returns:

true if the oldUrl was found and replaced with newUrl. Otherwise false