|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.poi.POIDocument
org.apache.poi.hssf.usermodel.HSSFWorkbook
public final class 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.
InternalWorkbook,
HSSFSheet| Field Summary | |
|---|---|
protected java.util.List<HSSFSheet> |
_sheets
this holds the HSSFSheet objects attached to this workbook |
static int |
INITIAL_CAPACITY
used for compile-time performance/memory optimization. |
| Fields inherited from interface org.apache.poi.ss.usermodel.Workbook |
|---|
PICTURE_TYPE_DIB, PICTURE_TYPE_EMF, PICTURE_TYPE_JPEG, PICTURE_TYPE_PICT, PICTURE_TYPE_PNG, PICTURE_TYPE_WMF, SHEET_STATE_HIDDEN, SHEET_STATE_VERY_HIDDEN, SHEET_STATE_VISIBLE |
| Constructor Summary | |
|---|---|
HSSFWorkbook()
Creates new HSSFWorkbook from scratch (start here!) |
|
HSSFWorkbook(DirectoryNode directory,
boolean preserveNodes)
given a POI POIFSFileSystem object, and a specific directory within it, read in its Workbook and populate the high and low level models. |
|
HSSFWorkbook(DirectoryNode directory,
POIFSFileSystem fs,
boolean preserveNodes)
given a POI POIFSFileSystem object, and a specific directory within it, read in its Workbook and populate the high and low level models. |
|
HSSFWorkbook(java.io.InputStream s)
Companion to HSSFWorkbook(POIFSFileSystem), this constructs the POI filesystem around your InputStream, including all nodes. |
|
HSSFWorkbook(java.io.InputStream s,
boolean preserveNodes)
Companion to HSSFWorkbook(POIFSFileSystem), this constructs the POI filesystem around your InputStream. |
|
HSSFWorkbook(NPOIFSFileSystem fs)
Given a POI POIFSFileSystem object, read in its Workbook along with all related nodes, and populate the high and low level models. |
|
HSSFWorkbook(POIFSFileSystem fs)
Given a POI POIFSFileSystem object, read in its Workbook along with all related nodes, and populate the high and low level models. |
|
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 |
addOlePackage(byte[] oleData,
java.lang.String label,
java.lang.String fileName,
java.lang.String command)
Adds an OLE package manager object with the given content to the sheet |
int |
addOlePackage(POIFSFileSystem poiData,
java.lang.String label,
java.lang.String fileName,
java.lang.String command)
Adds an OLE package manager object with the given POIFS to the sheet |
int |
addPicture(byte[] pictureData,
int format)
Adds a picture to the workbook. |
void |
addToolPack(UDFFinder toopack)
Register a new toolpack in this workbook. |
boolean |
changeExternalReference(java.lang.String oldUrl,
java.lang.String newUrl)
Changes an external referenced file to another file. |
HSSFSheet |
cloneSheet(int sheetIndex)
create an HSSFSheet from an existing sheet in the HSSFWorkbook. |
void |
close()
Closes the underlying NPOIFSFileSystem from which
the Workbook was read, if any. |
static HSSFWorkbook |
create(InternalWorkbook book)
|
HSSFCellStyle |
createCellStyle()
Create a new Cell style and add it to the workbook's style table. |
HSSFDataFormat |
createDataFormat()
Returns the instance of HSSFDataFormat for this workbook. |
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 a new sheet for this Workbook and return the high level representation. |
void |
dumpDrawingGroupRecords(boolean fat)
Spits out a list of all the drawing records in the workbook. |
protected void |
encryptBytes(byte[] buf)
|
HSSFFont |
findFont(boolean bold,
short color,
short fontHeight,
java.lang.String name,
boolean italic,
boolean strikeout,
short typeOffset,
byte underline)
Finds a font that matches the one with the supplied attributes |
int |
getActiveSheetIndex()
gets the tab whose data is actually seen when the sheet is opened. |
java.util.List<HSSFObjectData> |
getAllEmbeddedObjects()
Gets all embedded OLE2 objects from the Workbook. |
java.util.List<HSSFName> |
getAllNames()
Returns all defined names. |
java.util.List<HSSFPictureData> |
getAllPictures()
Gets all pictures from the Workbook. |
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(int idx)
get the cell style object at the given index |
HSSFCreationHelper |
getCreationHelper()
Returns an object that handles instantiating concrete classes of the various instances one needs for HSSF and XSSF. |
HSSFPalette |
getCustomPalette()
|
EncryptionInfo |
getEncryptionInfo()
|
int |
getFirstVisibleTab()
sets the first tab that is displayed in the list of tabs in excel. |
HSSFFont |
getFontAt(short idx)
Get the font at the given index number |
boolean |
getForceFormulaRecalculation()
Whether Excel will be asked to recalculate all formulas when the workbook is opened. |
InternalWorkbook |
getInternalWorkbook()
|
Row.MissingCellPolicy |
getMissingCellPolicy()
Retrieves the current policy on what to do when getting missing or blank cells from a row. |
HSSFName |
getName(java.lang.String name)
|
HSSFName |
getNameAt(int nameIndex)
|
int |
getNameIndex(java.lang.String name)
Gets the defined name index by name Note: Excel defined names are case-insensitive and this method performs a case-insensitive search. |
java.lang.String |
getNameName(int index)
gets the named range name |
NameRecord |
getNameRecord(int nameIndex)
|
java.util.List<HSSFName> |
getNames(java.lang.String name)
Returns all defined names with the given name. |
short |
getNumberOfFonts()
get the number of fonts in the font table |
int |
getNumberOfNames()
|
int |
getNumberOfSheets()
get the number of spreadsheets in the workbook (this will be three after serialization) |
int |
getNumCellStyles()
get the number of styles the workbook contains |
protected static java.util.Map<java.lang.String,ClassID> |
getOleMap()
|
java.lang.String |
getPrintArea(int sheetIndex)
Retrieves the reference for the printarea of the specified sheet, the sheet name is appended to the reference even if it was not specified. |
DirectoryNode |
getRootDirectory()
Deprecated. POI 3.16 beta 1. use POIDocument.getDirectory() instead |
java.util.Collection<java.lang.Integer> |
getSelectedTabs()
Gets the selected sheets (if more than one, Excel calls these a [Group]). |
HSSFSheet |
getSheet(java.lang.String name)
Get sheet with the given name (case insensitive match) |
HSSFSheet |
getSheetAt(int index)
Get the HSSFSheet object at the given index. |
int |
getSheetIndex(Sheet sheet)
Returns the index of the given sheet |
int |
getSheetIndex(java.lang.String name)
Returns the index of the sheet by his name |
java.lang.String |
getSheetName(int sheetIndex)
Get the sheet name |
SheetVisibility |
getSheetVisibility(int sheetIx)
Get the visibility (visible, hidden, very hidden) of a sheet in this workbook |
SpreadsheetVersion |
getSpreadsheetVersion()
Returns the spreadsheet version (EXCLE97) of this workbook |
static java.lang.String |
getWorkbookDirEntryName(DirectoryNode directory)
|
void |
insertChartRecord()
Test only. |
boolean |
isHidden()
|
boolean |
isSheetHidden(int sheetIx)
Check whether a sheet is hidden. |
boolean |
isSheetVeryHidden(int sheetIx)
Check whether a sheet is very hidden. |
boolean |
isWriteProtected()
Is the workbook protected with a password (not encrypted)? |
java.util.Iterator<Sheet> |
iterator()
Alias for sheetIterator() to allow
foreach loops |
int |
linkExternalWorkbook(java.lang.String name,
Workbook workbook)
Adds the LinkTable records required to allow formulas referencing the specified external workbook to be added to this one. |
void |
removeName(int index)
Remove the defined name at the specified index |
void |
removeName(Name name)
As removeName(String) is not necessarily unique
(name + sheet index is unique), this method is more accurate. |
void |
removeName(java.lang.String name)
Remove a defined name by name |
void |
removePrintArea(int sheetIndex)
Delete the printarea for the sheet specified |
void |
removeSheetAt(int index)
Removes sheet at the given index. |
protected void |
resetFontCache()
Reset the fonts cache, causing all new calls to getFontAt() to create new objects. |
void |
setActiveSheet(int index)
Convenience method to set the active sheet. |
void |
setBackupFlag(boolean backupValue)
determine whether the Excel GUI will backup the workbook when saving. |
void |
setFirstVisibleTab(int index)
sets the first tab that is displayed in the list of tabs in excel. |
void |
setForceFormulaRecalculation(boolean value)
Whether the application shall perform a full recalculation when the workbook is opened. |
void |
setHidden(boolean hiddenFlag)
|
void |
setMissingCellPolicy(Row.MissingCellPolicy missingCellPolicy)
Sets the policy on what to do when getting missing or blank cells from a row. |
void |
setPrintArea(int sheetIndex,
int startColumn,
int endColumn,
int startRow,
int endRow)
For the Convenience of Java Programmers maintaining pointers. |
void |
setPrintArea(int sheetIndex,
java.lang.String reference)
Sets the printarea for the sheet provided |
void |
setSelectedTab(int index)
Selects a single sheet. |
void |
setSelectedTabs(java.util.Collection<java.lang.Integer> indexes)
Selects multiple sheets as a group. |
void |
setSelectedTabs(int[] indexes)
Selects multiple sheets as a group. |
void |
setSheetHidden(int sheetIx,
boolean hidden)
Hide or unhide a sheet. |
void |
setSheetHidden(int sheetIx,
int hidden)
Deprecated. |
void |
setSheetName(int sheetIx,
java.lang.String name)
Set the sheet name. |
void |
setSheetOrder(java.lang.String sheetname,
int pos)
sets the order of appearance for a given sheet. |
void |
setSheetVisibility(int sheetIx,
SheetVisibility visibility)
Hide or unhide a sheet. |
java.util.Iterator<Sheet> |
sheetIterator()
Returns an iterator of the sheets in the workbook in sheet order. |
void |
unwriteProtectWorkbook()
removes the write protect flag |
void |
write()
Write out this workbook to the currently open File via the
writeable POIFSFileSystem it was opened as. |
void |
write(java.io.File newFile)
Method write - write out this workbook to a new File. |
void |
write(java.io.OutputStream stream)
Method write - write out this workbook to an OutputStream. |
void |
writeProtectWorkbook(java.lang.String password,
java.lang.String username)
protect a workbook with a password (not encypted, just sets writeprotect flags and the password. |
| 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
protected java.util.List<HSSFSheet> _sheets
| Constructor Detail |
|---|
public HSSFWorkbook()
public HSSFWorkbook(POIFSFileSystem fs)
throws java.io.IOException
This calls HSSFWorkbook(POIFSFileSystem, boolean) with
preserve nodes set to true.
java.io.IOException - if the stream cannot be readHSSFWorkbook(POIFSFileSystem, boolean),
POIFSFileSystem
public HSSFWorkbook(NPOIFSFileSystem fs)
throws java.io.IOException
This calls HSSFWorkbook(POIFSFileSystem, boolean) with
preserve nodes set to true.
java.io.IOException - if the stream cannot be readHSSFWorkbook(POIFSFileSystem, boolean),
POIFSFileSystem
public HSSFWorkbook(POIFSFileSystem fs,
boolean preserveNodes)
throws java.io.IOException
fs - the POI filesystem that contains the Workbook stream.preserveNodes - whether to preserve other nodes, such as
macros. This takes more memory, so only say yes if you
need to. If set, will store all of the POIFSFileSystem
in memory
java.io.IOException - if the stream cannot be readPOIFSFileSystem
public HSSFWorkbook(DirectoryNode directory,
POIFSFileSystem fs,
boolean preserveNodes)
throws java.io.IOException
directory - the POI filesystem directory to process fromfs - the POI filesystem that contains the Workbook stream.preserveNodes - whether to preserve other nodes, such as
macros. This takes more memory, so only say yes if you
need to. If set, will store all of the POIFSFileSystem
in memory
java.io.IOException - if the stream cannot be readPOIFSFileSystem
public HSSFWorkbook(DirectoryNode directory,
boolean preserveNodes)
throws java.io.IOException
directory - the POI filesystem directory to process frompreserveNodes - whether to preserve other nodes, such as
macros. This takes more memory, so only say yes if you
need to. If set, will store all of the POIFSFileSystem
in memory
java.io.IOException - if the stream cannot be readPOIFSFileSystem
public HSSFWorkbook(java.io.InputStream s)
throws java.io.IOException
InputStream, including all nodes.
This calls HSSFWorkbook(InputStream, boolean) with
preserve nodes set to true.
java.io.IOException - if the stream cannot be readHSSFWorkbook(InputStream, boolean),
HSSFWorkbook(POIFSFileSystem),
POIFSFileSystem
public HSSFWorkbook(java.io.InputStream s,
boolean preserveNodes)
throws java.io.IOException
InputStream.
s - the POI filesystem that contains the Workbook stream.preserveNodes - whether to preserve 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 static HSSFWorkbook create(InternalWorkbook book)
public static java.lang.String getWorkbookDirEntryName(DirectoryNode directory)
public Row.MissingCellPolicy getMissingCellPolicy()
Row.MissingCellPolicy
getMissingCellPolicy in interface Workbookpublic void setMissingCellPolicy(Row.MissingCellPolicy missingCellPolicy)
HSSFRow.getCell(int)}. See
Row.MissingCellPolicy.
Note that this has no effect on any
iterators, only on when fetching Cells
by their column index.
setMissingCellPolicy in interface Workbook
public void setSheetOrder(java.lang.String sheetname,
int pos)
setSheetOrder in interface Workbooksheetname - the name of the sheet to reorderpos - the position that we want to insert the sheet into (0 based)public void setSelectedTab(int index)
setSelectedTab in interface Workbookindex - the index of the sheet to select (0 based)Sheet.setSelected(boolean)public void setSelectedTabs(int[] indexes)
indexes.
indexes - Array of sheets to select, the index is 0-based.public void setSelectedTabs(java.util.Collection<java.lang.Integer> indexes)
indexes.
indexes - Collection of sheets to select, the index is 0-based.public java.util.Collection<java.lang.Integer> getSelectedTabs()
public void setActiveSheet(int index)
setActiveSheet in interface Workbookindex - index of the active sheet (0-based)public int getActiveSheetIndex()
getActiveSheetIndex in interface WorkbookHSSFSheet.setSelected(boolean)public void setFirstVisibleTab(int index)
setFirstVisibleTab in interface Workbookindex - the sheet index of the tab that will become the first in the tab-barpublic int getFirstVisibleTab()
getFirstVisibleTab in interface Workbook
public void setSheetName(int sheetIx,
java.lang.String name)
setSheetName in interface WorkbooksheetIx - number (0 based)
java.lang.IllegalArgumentException - if the name is null or invalid
or workbook already contains a sheet with this namecreateSheet(String),
WorkbookUtil.createSafeSheetName(String nameProposal)public java.lang.String getSheetName(int sheetIndex)
Workbook
getSheetName in interface WorkbooksheetIndex - sheet number (0 based)
public boolean isHidden()
isHidden in interface Workbookfalse if this workbook is not visible in the GUIpublic void setHidden(boolean hiddenFlag)
setHidden in interface WorkbookhiddenFlag - pass false to make the workbook visible in the GUIpublic boolean isSheetHidden(int sheetIx)
Workbook
Note that a sheet could instead be set to be very hidden, which is different
(Workbook.isSheetVeryHidden(int))
isSheetHidden in interface WorkbooksheetIx - Number
true if sheet is hiddenWorkbook.getSheetVisibility(int)public boolean isSheetVeryHidden(int sheetIx)
Workbook
This is different from the normal hidden status
(Workbook.isSheetHidden(int))
isSheetVeryHidden in interface WorkbooksheetIx - sheet index to check
true if sheet is very hiddenWorkbook.getSheetVisibility(int)public SheetVisibility getSheetVisibility(int sheetIx)
Workbook
getSheetVisibility in interface WorkbooksheetIx - the index of the sheet
public void setSheetHidden(int sheetIx,
boolean hidden)
Workbook
setSheetHidden in interface WorkbooksheetIx - the sheet index (0-based)hidden - True to mark the sheet as hidden, false otherwiseWorkbook.setSheetVisibility(int, SheetVisibility)
@Removal(version="3.18")
@Deprecated
public void setSheetHidden(int sheetIx,
int hidden)
Workbook
setSheetHidden in interface WorkbooksheetIx - the sheet index (0-based)hidden - one of the following Workbook constants:
Workbook.SHEET_STATE_VISIBLE,
Workbook.SHEET_STATE_HIDDEN, or
Workbook.SHEET_STATE_VERY_HIDDEN.
public void setSheetVisibility(int sheetIx,
SheetVisibility visibility)
Workbook
setSheetVisibility in interface WorkbooksheetIx - the sheet index (0-based)visibility - the sheet visibility to setpublic int getSheetIndex(java.lang.String name)
getSheetIndex in interface Workbookname - the sheet name
public int getSheetIndex(Sheet sheet)
getSheetIndex in interface Workbooksheet - the sheet to look up
public HSSFSheet createSheet()
createSheet in interface Workbookpublic HSSFSheet cloneSheet(int sheetIndex)
cloneSheet in interface Workbookpublic HSSFSheet createSheet(java.lang.String sheetname)
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.
POI's SpreadsheetAPI silently truncates the input argument to 31 characters. Example:
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:
createSheet in interface Workbooksheetname - sheetname to set for the sheet.
java.lang.IllegalArgumentException - if the name is null or invalid
or workbook already contains a sheet with this nameWorkbookUtil.createSafeSheetName(String nameProposal)public java.util.Iterator<Sheet> sheetIterator()
sheetIterator in interface Workbookpublic java.util.Iterator<Sheet> iterator()
sheetIterator() to allow
foreach loops
iterator in interface java.lang.Iterable<Sheet>public int getNumberOfSheets()
getNumberOfSheets in interface Workbookpublic HSSFSheet getSheetAt(int index)
getSheetAt in interface Workbookindex - of the sheet number (0-based physical & logical)
java.lang.IllegalArgumentException - if the index is out of range (index
< 0 || index >= getNumberOfSheets()).public HSSFSheet getSheet(java.lang.String name)
getSheet in interface Workbookname - of the sheet
null if it does not existpublic void removeSheetAt(int 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.
removeSheetAt in interface Workbookindex - of the sheet (0-based)public void setBackupFlag(boolean backupValue)
backupValue - true to indicate a backup will be performed.public boolean getBackupFlag()
public HSSFFont createFont()
createFont in interface Workbook
public HSSFFont findFont(boolean bold,
short color,
short fontHeight,
java.lang.String name,
boolean italic,
boolean strikeout,
short typeOffset,
byte underline)
findFont in interface Workbooknullpublic short getNumberOfFonts()
getNumberOfFonts in interface Workbookpublic HSSFFont getFontAt(short idx)
getFontAt in interface Workbookidx - index number
protected void resetFontCache()
public HSSFCellStyle createCellStyle()
createCellStyle in interface Workbookjava.lang.IllegalStateException - if the number of cell styles exceeded the limit for this type of Workbook.public int getNumCellStyles()
getNumCellStyles in interface Workbookpublic HSSFCellStyle getCellStyleAt(int idx)
getCellStyleAt in interface Workbookidx - index within the set of styles
public void close()
throws java.io.IOException
NPOIFSFileSystem from which
the Workbook was read, if any.
Once this has been called, no further operations, updates or reads should be performed on the Workbook.
close in interface java.io.Closeableclose in interface Workbookclose in class POIDocumentjava.io.IOException
public void write()
throws java.io.IOException
File via the
writeable POIFSFileSystem it was opened as.
This will fail (with an IllegalStateException if the
Workbook was opened read-only, opened from an InputStream
instead of a File, or if this is not the root document. For those cases,
you must use write(OutputStream) or write(File) to
write to a brand new document.
write in class POIDocumentjava.io.IOException - thrown on errors writing to the file
public void write(java.io.File newFile)
throws java.io.IOException
File. Constructs
a new POI POIFSFileSystem, passes in the workbook binary representation and
writes it out. If the file exists, it will be replaced, otherwise a new one
will be created.
Note that you cannot write to the currently open File using this method.
If you opened your Workbook from a File, you must use the write()
method instead!
write in class POIDocumentnewFile - The new File you wish to write the XLS to
java.io.IOException - if anything can't be written.POIFSFileSystem
public void write(java.io.OutputStream stream)
throws java.io.IOException
OutputStream. Constructs
a new POI POIFSFileSystem, passes in the workbook binary representation and
writes it out.
If stream is a FileOutputStream on a networked drive
or has a high cost/latency associated with each written byte,
consider wrapping the OutputStream in a BufferedOutputStream
to improve write performance.
write in interface Workbookwrite in class POIDocumentstream - - the java OutputStream you wish to write the XLS to
java.io.IOException - if anything can't be written.POIFSFileSystempublic byte[] getBytes()
protected void encryptBytes(byte[] buf)
public int getNumberOfNames()
getNumberOfNames in interface Workbookpublic HSSFName getName(java.lang.String name)
getName in interface Workbookname - the name of the defined name
null if not found.public java.util.List<HSSFName> getNames(java.lang.String name)
Workbook
getNames in interface Workbookname - the name of the defined name
public HSSFName getNameAt(int nameIndex)
getNameAt in interface WorkbooknameIndex - position of the named range (0-based)
public java.util.List<HSSFName> getAllNames()
Workbook
getAllNames in interface Workbookpublic NameRecord getNameRecord(int nameIndex)
public java.lang.String getNameName(int index)
index - the named range index (0 based)
public void setPrintArea(int sheetIndex,
java.lang.String reference)
i.e. Reference = $A$1:$B$2
setPrintArea in interface WorkbooksheetIndex - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)reference - Valid name Reference for the Print Area
public void setPrintArea(int sheetIndex,
int startColumn,
int endColumn,
int startRow,
int endRow)
setPrintArea in interface WorkbooksheetIndex - Zero-based sheet index (0 = First Sheet)startColumn - Column to begin printareaendColumn - Column to end the printareastartRow - Row to begin the printareaendRow - Row to end the printareasetPrintArea(int, String)public java.lang.String getPrintArea(int sheetIndex)
getPrintArea in interface WorkbooksheetIndex - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
public void removePrintArea(int sheetIndex)
removePrintArea in interface WorkbooksheetIndex - Zero-based sheet index (0 = First Sheet)public HSSFName createName()
createName in interface Workbookpublic int getNameIndex(java.lang.String name)
Workbook
getNameIndex in interface Workbookname - the name of the defined name
public void removeName(int index)
Workbook
removeName in interface Workbookindex - named range index (0 based)public HSSFDataFormat createDataFormat()
createDataFormat in interface WorkbookFormatRecord,
Recordpublic void removeName(java.lang.String name)
Workbook
removeName in interface Workbookname - the name of the defined namepublic void removeName(Name name)
removeName(String) is not necessarily unique
(name + sheet index is unique), this method is more accurate.
removeName in interface Workbookname - the name to remove.public HSSFPalette getCustomPalette()
public void insertChartRecord()
public void dumpDrawingGroupRecords(boolean fat)
public int addPicture(byte[] pictureData,
int format)
addPicture in interface WorkbookpictureData - The bytes of the pictureformat - The format of the picture. One of PICTURE_TYPE_*
Workbook.PICTURE_TYPE_WMF,
Workbook.PICTURE_TYPE_EMF,
Workbook.PICTURE_TYPE_PICT,
Workbook.PICTURE_TYPE_PNG,
Workbook.PICTURE_TYPE_JPEG,
Workbook.PICTURE_TYPE_DIBpublic java.util.List<HSSFPictureData> getAllPictures()
getAllPictures in interface WorkbookHSSFPictureData objects.)protected static java.util.Map<java.lang.String,ClassID> getOleMap()
public int addOlePackage(POIFSFileSystem poiData,
java.lang.String label,
java.lang.String fileName,
java.lang.String command)
throws java.io.IOException
poiData - an POIFS containing the embedded document, to be addedlabel - the label of the payloadfileName - the original filenamecommand - the command to open the payload
java.io.IOException - if the object can't be embedded
public int addOlePackage(byte[] oleData,
java.lang.String label,
java.lang.String fileName,
java.lang.String command)
throws java.io.IOException
Workbook
addOlePackage in interface WorkbookoleData - the payloadlabel - the label of the payloadfileName - the original filenamecommand - the command to open the payload
java.io.IOException - if the object can't be embedded
public int linkExternalWorkbook(java.lang.String name,
Workbook workbook)
linkExternalWorkbook in interface Workbookname - The name the workbook will be referenced as in formulasworkbook - The open workbook to fetch the link required information frompublic boolean isWriteProtected()
public void writeProtectWorkbook(java.lang.String password,
java.lang.String username)
password - to setpublic void unwriteProtectWorkbook()
public java.util.List<HSSFObjectData> getAllEmbeddedObjects()
HSSFObjectData objects.)public HSSFCreationHelper getCreationHelper()
Workbook
getCreationHelper in interface Workbookpublic void addToolPack(UDFFinder toopack)
addToolPack in interface Workbooktoopack - the toolpack to registerpublic void setForceFormulaRecalculation(boolean value)
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.
setForceFormulaRecalculation in interface Workbookvalue - true if the application will perform a full recalculation of
workbook values when the workbook is openedpublic boolean getForceFormulaRecalculation()
getForceFormulaRecalculation in interface Workbook
public boolean changeExternalReference(java.lang.String oldUrl,
java.lang.String newUrl)
oldUrl - The old URL to search for and which is to be replacednewUrl - The URL replacement
@Deprecated @Removal(version="3.18") public DirectoryNode getRootDirectory()
POIDocument.getDirectory() instead
@Internal public InternalWorkbook getInternalWorkbook()
public SpreadsheetVersion getSpreadsheetVersion()
getSpreadsheetVersion in interface Workbookpublic EncryptionInfo getEncryptionInfo()
getEncryptionInfo in class POIDocumentnull
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||