Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hssf.usermodel
Class HSSFWorkbook

    java.lang.Object
      org.apache.poi.POIDocument
          org.apache.poi.hssf.usermodel.HSSFWorkbook

All Implemented Interfaces:
  Workbook

    public final class HSSFWorkbook

extends POIDocument
implements Workbook

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.

Author:
  Andrew C. Oliver (acoliver at apache dot org), Glen Stampoultzis (glens at apache.org), Shawn Laubach (slaubach at apache dot org)
See Also:
  `InternalWorkbook`, `HSSFSheet`

Field Summary
`protected java.util.List` | `_sheets` this holds the HSSFSheet objects attached to this workbook
`static int` | `INITIAL_CAPACITY` used for compile-time performance/memory optimization.

Fields inherited from class org.apache.poi.POIDocument
`directory, filesystem`

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, 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)`
`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` | `addPicture(byte[] pictureData, int format)` Adds a picture to the workbook.
`int` | `addSSTString(java.lang.String string)` Deprecated. Do not call this method from your applications. Use the methods available in the HSSFRow to add string HSSFCells
`HSSFSheet` | `cloneSheet(int sheetIndex)` create an HSSFSheet from an existing sheet in the HSSFWorkbook.
`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 an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation.
`void` | `dumpDrawingGroupRecords(boolean fat)` Spits out a list of all the drawing records in the workbook.
`HSSFFont` | `findFont(short boldWeight, 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
`java.lang.String` | `findSheetNameFromExternSheet(int externSheetIndex)` Deprecated. for POI internal use only (formula rendering). This method is likely to be removed in future versions of POI.
`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<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(short idx)` get the cell style object at the given index
`CreationHelper` | `getCreationHelper()` Returns an object that handles instantiating concrete classes of the various instances one needs for HSSF and XSSF.
`HSSFPalette` | `getCustomPalette()`
`short` | `getDisplayedTab()` Deprecated. - Misleading name - use getFirstVisibleTab()
`int` | `getExternalSheetIndex(int internalSheetIndex)` Deprecated. for POI internal use only (formula parsing). This method is likely to be removed in future versions of POI.
`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
`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)`
`NameXPtg` | `getNameXPtg(java.lang.String name)` Note - This method should only used by POI internally.
`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)
`short` | `getNumCellStyles()` get the number of styles the workbook contains
`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.
`short` | `getSelectedTab()` Deprecated. - Misleading name - use getActiveSheetIndex()
`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
`int` | `getSheetIndexFromExternSheetIndex(int externSheetNumber)`
`java.lang.String` | `getSheetName(int sheetIndex)` Set the sheet name
`java.lang.String` | `getSSTString(int index)` Deprecated. Do not call this method from your applications. Use the methods available in the HSSFRow to get string HSSFCells
`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)?
`void` | `removeName(int index)` Remove the defined name at the specified index
`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. Care must be taken if the removed sheet is the currently active or only selected sheet in the workbook.
`protected void` | `resetFontCache()` Reset the fonts cache, causing all new calls to getFontAt() to create new objects.
`java.lang.String` | `resolveNameXText(int refIndex, int definedNameIndex)` Deprecated. for POI internal use only (formula rendering). This method is likely to be removed in future versions of POI.
`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` | `setDisplayedTab(short index)` Deprecated. - Misleading name - use setFirstVisibleTab()
`void` | `setFirstVisibleTab(int index)` sets the first tab that is displayed in the list of tabs in excel.
`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` | `setRepeatingRowsAndColumns(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow)` Sets the repeating rows and columns for a sheet (as found in 2003:File->PageSetup->Sheet, 2007:Page Layout->Print Titles).
`void` | `setSelectedTab(int index)` Selects a single sheet.
`void` | `setSelectedTab(short index)` Deprecated. use setSelectedTab(int)
`void` | `setSelectedTabs(int[] indexes)`
`void` | `setSheetHidden(int sheetIx, boolean hidden)` Hide or unhide a sheet
`void` | `setSheetHidden(int sheetIx, int hidden)` Hide or unhide a sheet.
`void` | `setSheetName(int sheetIx, java.lang.String name)` Sets the sheet name.
`void` | `setSheetOrder(java.lang.String sheetname, int pos)` sets the order of appearance for a given sheet.
`void` | `unwriteProtectWorkbook()` removes the write protect flag
`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 org.apache.poi.POIDocument
`copyNodes, createInformationProperties, getDocumentSummaryInformation, getPropertySet, getSummaryInformation, readProperties, writeProperties, writeProperties, writePropertySet`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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!

  See Also:
    Constant Field Values

### _sheets

    protected java.util.List _sheets

  this holds the HSSFSheet objects attached to this workbook

Constructor Detail

### HSSFWorkbook

    public HSSFWorkbook()

  Creates new HSSFWorkbook from scratch (start here!)

### HSSFWorkbook

    public HSSFWorkbook(POIFSFileSystem fs)
                 throws java.io.IOException

Throws:
  `java.io.IOException`

### HSSFWorkbook

    public HSSFWorkbook(POIFSFileSystem fs,
                        boolean preserveNodes)
                 throws java.io.IOException

  given a POI POIFSFileSystem object, read in its Workbook and populate the high and low level models. If you're reading in a workbook...start here.

  Parameters:
    `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. If set, will store all of the POIFSFileSystem in memory
  Throws:
    `java.io.IOException` - if the stream cannot be read
  See Also:
    `POIFSFileSystem`

### HSSFWorkbook

    public HSSFWorkbook(DirectoryNode directory,
                        POIFSFileSystem fs,
                        boolean preserveNodes)
                 throws java.io.IOException

  given a POI POIFSFileSystem object, and a specific directory within it, read in its Workbook and populate the high and low level models. If you're reading in a workbook...start here.

  Parameters:
    `directory` - the POI filesystem directory to process from
    `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. If set, will store all of the POIFSFileSystem in memory
  Throws:
    `java.io.IOException` - if the stream cannot be read
  See Also:
    `POIFSFileSystem`

### HSSFWorkbook

    public HSSFWorkbook(java.io.InputStream s)
                 throws java.io.IOException

Throws:
  `java.io.IOException`

### HSSFWorkbook

    public HSSFWorkbook(java.io.InputStream s,
                        boolean preserveNodes)
                 throws java.io.IOException

  Companion to HSSFWorkbook(POIFSFileSystem), this constructs the POI filesystem around your inputstream.

  Parameters:
    `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.
  Throws:
    `java.io.IOException` - if the stream cannot be read
  See Also:
    `POIFSFileSystem`, `HSSFWorkbook(POIFSFileSystem)`

Method Detail

### create

    public static HSSFWorkbook create(InternalWorkbook book)

### getMissingCellPolicy

    public Row.MissingCellPolicy getMissingCellPolicy()

  Retrieves the current policy on what to do when getting missing or blank cells from a row. The default is to return blank and null cells. `Row.MissingCellPolicy`

  Specified by:
    `getMissingCellPolicy` in interface `Workbook`

### setMissingCellPolicy

    public void setMissingCellPolicy(Row.MissingCellPolicy missingCellPolicy)

  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.

  Specified by:
    `setMissingCellPolicy` in interface `Workbook`

### setSheetOrder

    public void setSheetOrder(java.lang.String sheetname,
                              int pos)

  sets the order of appearance for a given sheet.

  Specified by:
    `setSheetOrder` in interface `Workbook`
  Parameters:
    `sheetname` - the name of the sheet to reorder
    `pos` - the position that we want to insert the sheet into (0 based)

### setSelectedTab

    public void setSelectedTab(int index)

  Selects a single sheet. This may be different to the 'active' sheet (which is the sheet with focus).

  Specified by:
    `setSelectedTab` in interface `Workbook`
  Parameters:
    `index` - the index of the sheet to select (0 based)
  See Also:
    `Sheet.setSelected(boolean)`

### setSelectedTab

    public void setSelectedTab(short index)

  Deprecated. use setSelectedTab(int)

  deprecated May 2008

### setSelectedTabs

    public void setSelectedTabs(int[] indexes)

### setActiveSheet

    public void setActiveSheet(int index)

  Convenience method to set the active sheet. The active sheet is is the sheet which is currently displayed when the workbook is viewed in Excel. 'Selected' sheet(s) is a distinct concept.

  Specified by:
    `setActiveSheet` in interface `Workbook`
  Parameters:
    `index` - index of the active sheet (0-based)

### 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).

  Specified by:
    `getActiveSheetIndex` in interface `Workbook`
  Returns:
    the index of the active sheet (0-based)
  See Also:
    `HSSFSheet.setSelected(boolean)`

### getSelectedTab

    public short getSelectedTab()

  Deprecated. - Misleading name - use getActiveSheetIndex()

  deprecated May 2008

### setFirstVisibleTab

    public void setFirstVisibleTab(int index)

  sets the first tab that is displayed in the list of tabs in excel.

  Specified by:
    `setFirstVisibleTab` in interface `Workbook`
  Parameters:
    `index` -

### setDisplayedTab

    public void setDisplayedTab(short index)

  Deprecated. - Misleading name - use setFirstVisibleTab()

  deprecated May 2008

### getFirstVisibleTab

    public int getFirstVisibleTab()

  sets the first tab that is displayed in the list of tabs in excel.

  Specified by:
    `getFirstVisibleTab` in interface `Workbook`
  Returns:
    the first tab that to display in the list of tabs (0-based).

### getDisplayedTab

    public short getDisplayedTab()

  Deprecated. - Misleading name - use getFirstVisibleTab()

  deprecated May 2008

### setSheetName

    public void setSheetName(int sheetIx,
                             java.lang.String name)

  Sets the sheet name. Will throw IllegalArgumentException if the name is duplicated or contains /\?*[] Note - Excel allows sheet names up to 31 chars in length but other applications allow more. Excel does not crash with names longer than 31 chars, but silently truncates such names to 31 chars. POI enforces uniqueness on the first 31 chars.

  Specified by:
    `setSheetName` in interface `Workbook`
  Parameters:
    `sheetIx` - number (0 based)

### getSheetName

    public java.lang.String getSheetName(int sheetIndex)

  Description copied from interface: `Workbook`
  Set the sheet name

  Specified by:
    `getSheetName` in interface `Workbook`
  Parameters:
    `sheetIndex` - sheet number (0 based)
  Returns:
    Sheet name for the specified index

### isHidden

    public boolean isHidden()

  Specified by:
    `isHidden` in interface `Workbook`
  Returns:
    `false` if this workbook is not visible in the GUI

### setHidden

    public void setHidden(boolean hiddenFlag)

  Specified by:
    `setHidden` in interface `Workbook`
  Parameters:
    `hiddenFlag` - pass `false` to make the workbook visible in the GUI

### isSheetHidden

    public boolean isSheetHidden(int sheetIx)

  Description copied from interface: `Workbook`
  Check whether a sheet is hidden.

  Note that a sheet could instead be set to be very hidden, which is different (`Workbook.isSheetVeryHidden(int)`)

  Specified by:
    `isSheetHidden` in interface `Workbook`
  Parameters:
    `sheetIx` - Number
  Returns:
    `true` if sheet is hidden

### isSheetVeryHidden

    public boolean isSheetVeryHidden(int sheetIx)

  Description copied from interface: `Workbook`
  Check whether a sheet is very hidden.

  This is different from the normal hidden status (`Workbook.isSheetHidden(int)`)

  Specified by:
    `isSheetVeryHidden` in interface `Workbook`
  Parameters:
    `sheetIx` - sheet index to check
  Returns:
    `true` if sheet is very hidden

### setSheetHidden

    public void setSheetHidden(int sheetIx,
                               boolean hidden)

  Description copied from interface: `Workbook`
  Hide or unhide a sheet

  Specified by:
    `setSheetHidden` in interface `Workbook`
  Parameters:
    `sheetIx` - the sheet index (0-based)
    `hidden` - True to mark the sheet as hidden, false otherwise

### setSheetHidden

    public void setSheetHidden(int sheetIx,
                               int hidden)

  Description copied from interface: `Workbook`
  Hide or unhide a sheet.
  - 0 - visible.
  - 1 - hidden.
  - 2 - very hidden.

  Specified by:
    `setSheetHidden` in interface `Workbook`
  Parameters:
    `sheetIx` - 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`.

### getSheetIndex

    public int getSheetIndex(java.lang.String name)

  Returns the index of the sheet by his name

  Specified by:
    `getSheetIndex` in interface `Workbook`
  Parameters:
    `name` - the sheet name
  Returns:
    index of the sheet (0 based)

### getSheetIndex

    public int getSheetIndex(Sheet sheet)

  Returns the index of the given sheet

  Specified by:
    `getSheetIndex` in interface `Workbook`
  Parameters:
    `sheet` - the sheet to look up
  Returns:
    index of the sheet (0 based). `-1` if not found

### getExternalSheetIndex

    public int getExternalSheetIndex(int internalSheetIndex)

  Deprecated. for POI internal use only (formula parsing). This method is likely to be removed in future versions of POI.

  Returns the external sheet index of the sheet with the given internal index, creating one if needed. Used by some of the more obscure formula and named range things.

### findSheetNameFromExternSheet

    public java.lang.String findSheetNameFromExternSheet(int externSheetIndex)

  Deprecated. for POI internal use only (formula rendering). This method is likely to be removed in future versions of POI.

### resolveNameXText

    public java.lang.String resolveNameXText(int refIndex,
                                             int definedNameIndex)

  Deprecated. for POI internal use only (formula rendering). This method is likely to be removed in future versions of POI.

  Parameters:
    `refIndex` - Index to REF entry in EXTERNSHEET record in the Link Table
    `definedNameIndex` - zero-based to DEFINEDNAME or EXTERNALNAME record
  Returns:
    the string representation of the defined or external name

### createSheet

    public HSSFSheet createSheet()

  create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation. Use this to create new sheets.

  Specified by:
    `createSheet` in interface `Workbook`
  Returns:
    HSSFSheet representing the new sheet.

### cloneSheet

    public HSSFSheet cloneSheet(int sheetIndex)

  create an HSSFSheet from an existing sheet in the HSSFWorkbook.

  Specified by:
    `cloneSheet` in interface `Workbook`
  Returns:
    HSSFSheet representing the cloned sheet.

### createSheet

    public HSSFSheet createSheet(java.lang.String sheetname)

  create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns the high level representation. Use this to create new sheets.

  Specified by:
    `createSheet` in interface `Workbook`
  Parameters:
    `sheetname` - the name for the new sheet. Note - certain length limits apply. See `setSheetName(int, String)`.
  Returns:
    HSSFSheet representing the new sheet.
  Throws:
    `java.lang.IllegalArgumentException` - if there is already a sheet present with a case-insensitive match for the specified name.
  See Also:
    `for a safe way to create valid names`

### getNumberOfSheets

    public int getNumberOfSheets()

  get the number of spreadsheets in the workbook (this will be three after serialization)

  Specified by:
    `getNumberOfSheets` in interface `Workbook`
  Returns:
    number of sheets

### getSheetIndexFromExternSheetIndex

    public int getSheetIndexFromExternSheetIndex(int externSheetNumber)

### getSheetAt

    public HSSFSheet getSheetAt(int index)

  Get the HSSFSheet object at the given index.

  Specified by:
    `getSheetAt` in interface `Workbook`
  Parameters:
    `index` - of the sheet number (0-based physical & logical)
  Returns:
    HSSFSheet at the provided index

### getSheet

    public HSSFSheet getSheet(java.lang.String name)

  Get sheet with the given name (case insensitive match)

  Specified by:
    `getSheet` in interface `Workbook`
  Parameters:
    `name` - of the sheet
  Returns:
    HSSFSheet with the name provided or `null` if it does not exist

### 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.

  Specified by:
    `removeSheetAt` in interface `Workbook`
  Parameters:
    `index` - of the sheet (0-based)

### setBackupFlag

    public void setBackupFlag(boolean backupValue)

  determine whether the Excel GUI will backup the workbook when saving.

  Parameters:
    `backupValue` - true to indicate a backup will be performed.

### getBackupFlag

    public boolean getBackupFlag()

  determine whether the Excel GUI will backup the workbook when saving.

  Returns:
    the current setting for backups.

### setRepeatingRowsAndColumns

    public void setRepeatingRowsAndColumns(int sheetIndex,
                                           int startColumn,
                                           int endColumn,
                                           int startRow,
                                           int endRow)

  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.

  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);

  Specified by:
    `setRepeatingRowsAndColumns` in interface `Workbook`
  Parameters:
    `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.

### createFont

    public HSSFFont createFont()

  create a new Font and add it to the workbook's font table

  Specified by:
    `createFont` in interface `Workbook`
  Returns:
    new font object

### findFont

    public HSSFFont findFont(short boldWeight,
                             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

  Specified by:
    `findFont` in interface `Workbook`
  Returns:
    the font with the matched attributes or `null`

### getNumberOfFonts

    public short getNumberOfFonts()

  get the number of fonts in the font table

  Specified by:
    `getNumberOfFonts` in interface `Workbook`
  Returns:
    number of fonts

### getFontAt

    public HSSFFont getFontAt(short idx)

  Get the font at the given index number

  Specified by:
    `getFontAt` in interface `Workbook`
  Parameters:
    `idx` - index number
  Returns:
    HSSFFont at the index

### resetFontCache

    protected void resetFontCache()

  Reset the fonts cache, causing all new calls to getFontAt() to create new objects. Should only be called after deleting fonts, and that's not something you should normally do

### createCellStyle

    public HSSFCellStyle createCellStyle()

  create a new Cell style and add it to the workbook's style table

  Specified by:
    `createCellStyle` in interface `Workbook`
  Returns:
    the new Cell Style object

### getNumCellStyles

    public short getNumCellStyles()

  get the number of styles the workbook contains

  Specified by:
    `getNumCellStyles` in interface `Workbook`
  Returns:
    count of cell styles

### getCellStyleAt

    public HSSFCellStyle getCellStyleAt(short idx)

  get the cell style object at the given index

  Specified by:
    `getCellStyleAt` in interface `Workbook`
  Parameters:
    `idx` - index within the set of styles
  Returns:
    HSSFCellStyle object at the index

### write

    public void write(java.io.OutputStream stream)
               throws java.io.IOException

  Method write - write out this workbook to an Outputstream. Constructs a new POI POIFSFileSystem, passes in the workbook binary representation and writes it out.

  Specified by:
    `write` in interface `Workbook`
  Specified by:
    `write` in class `POIDocument`
  Parameters:
    `stream` - - the java OutputStream you wish to write the XLS to
  Throws:
    `java.io.IOException` - if anything can't be written.
  See Also:
    `POIFSFileSystem`

### getBytes

    public byte[] getBytes()

  Method getBytes - get the bytes of just the HSSF portions of the XLS file. Use this to construct a POI POIFSFileSystem yourself.

  Returns:
    byte[] array containing the binary representation of this workbook and all contained sheets, rows, cells, etc.

### addSSTString

    public int addSSTString(java.lang.String string)

  Deprecated. Do not call this method from your applications. Use the methods available in the HSSFRow to add string HSSFCells

### getSSTString

    public java.lang.String getSSTString(int index)

  Deprecated. Do not call this method from your applications. Use the methods available in the HSSFRow to get string HSSFCells

### getNumberOfNames

    public int getNumberOfNames()

  Specified by:
    `getNumberOfNames` in interface `Workbook`
  Returns:
    the total number of defined names in this workbook

### getName

    public HSSFName getName(java.lang.String name)

  Specified by:
    `getName` in interface `Workbook`
  Parameters:
    `name` - the name of the defined name
  Returns:
    the defined name with the specified name. `null` if not found.

### getNameAt

    public HSSFName getNameAt(int nameIndex)

  Specified by:
    `getNameAt` in interface `Workbook`
  Parameters:
    `nameIndex` - position of the named range (0-based)
  Returns:
    the defined name at the specified index

### getNameRecord

    public NameRecord getNameRecord(int nameIndex)

### getNameName

    public java.lang.String getNameName(int index)

  gets the named range name

  Parameters:
    `index` - the named range index (0 based)
  Returns:
    named range name

### setPrintArea

    public void setPrintArea(int sheetIndex,
                             java.lang.String reference)

  Sets the printarea for the sheet provided

  i.e. Reference = $A$1:$B$2

  Specified by:
    `setPrintArea` in interface `Workbook`
  Parameters:
    `sheetIndex` - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
    `reference` - Valid name Reference for the Print Area

### setPrintArea

    public void setPrintArea(int sheetIndex,
                             int startColumn,
                             int endColumn,
                             int startRow,
                             int endRow)

  For the Convenience of Java Programmers maintaining pointers.

  Specified by:
    `setPrintArea` in interface `Workbook`
  Parameters:
    `sheetIndex` - Zero-based sheet index (0 = First Sheet)
    `startColumn` - Column to begin printarea
    `endColumn` - Column to end the printarea
    `startRow` - Row to begin the printarea
    `endRow` - Row to end the printarea
  See Also:
    `setPrintArea(int, String)`

### getPrintArea

    public 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.

  Specified by:
    `getPrintArea` in interface `Workbook`
  Parameters:
    `sheetIndex` - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
  Returns:
    String Null if no print area has been defined

### removePrintArea

    public void removePrintArea(int sheetIndex)

  Delete the printarea for the sheet specified

  Specified by:
    `removePrintArea` in interface `Workbook`
  Parameters:
    `sheetIndex` - Zero-based sheet index (0 = First Sheet)

### createName

    public HSSFName createName()

  creates a new named range and add it to the model

  Specified by:
    `createName` in interface `Workbook`
  Returns:
    named range high level

### getNameIndex

    public int getNameIndex(java.lang.String name)

  Description copied from interface: `Workbook`
  Gets the defined name index by name
  Note: Excel defined names are case-insensitive and this method performs a case-insensitive search.

  Specified by:
    `getNameIndex` in interface `Workbook`
  Parameters:
    `name` - the name of the defined name
  Returns:
    zero based index of the defined name. `-1` if not found.

### removeName

    public void removeName(int index)

  Description copied from interface: `Workbook`
  Remove the defined name at the specified index

  Specified by:
    `removeName` in interface `Workbook`
  Parameters:
    `index` - named range index (0 based)

### createDataFormat

    public HSSFDataFormat createDataFormat()

  Returns the instance of HSSFDataFormat for this workbook.

  Specified by:
    `createDataFormat` in interface `Workbook`
  Returns:
    the HSSFDataFormat object
  See Also:
    `FormatRecord`, `Record`

### removeName

    public void removeName(java.lang.String name)

  Description copied from interface: `Workbook`
  Remove a defined name by name

  Specified by:
    `removeName` in interface `Workbook`
  Parameters:
    `name` - the name of the defined name

### getCustomPalette

    public HSSFPalette getCustomPalette()

### insertChartRecord

    public void insertChartRecord()

  Test only. Do not use

### dumpDrawingGroupRecords

    public void dumpDrawingGroupRecords(boolean fat)

  Spits out a list of all the drawing records in the workbook.

### addPicture

    public int addPicture(byte[] pictureData,
                          int format)

  Adds a picture to the workbook.

  Specified by:
    `addPicture` in interface `Workbook`
  Parameters:
    `pictureData` - The bytes of the picture
    `format` - The format of the picture. One of `PICTURE_TYPE_*`
  Returns:
    the index to this picture (1 based).
  See Also:
    `Workbook.PICTURE_TYPE_EMF`, `Workbook.PICTURE_TYPE_WMF`, `Workbook.PICTURE_TYPE_PICT`, `Workbook.PICTURE_TYPE_JPEG`, `Workbook.PICTURE_TYPE_PNG`, `Workbook.PICTURE_TYPE_DIB`

### getAllPictures

    public java.util.List<HSSFPictureData> getAllPictures()

  Gets all pictures from the Workbook.

  Specified by:
    `getAllPictures` in interface `Workbook`
  Returns:
    the list of pictures (a list of `HSSFPictureData` objects.)

### isWriteProtected

    public boolean isWriteProtected()

  Is the workbook protected with a password (not encrypted)?

### writeProtectWorkbook

    public 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.

  Parameters:
    `password` - to set

### unwriteProtectWorkbook

    public void unwriteProtectWorkbook()

  removes the write protect flag

### getAllEmbeddedObjects

    public java.util.List<HSSFObjectData> getAllEmbeddedObjects()

  Gets all embedded OLE2 objects from the Workbook.

  Returns:
    the list of embedded objects (a list of `HSSFObjectData` objects.)

### getCreationHelper

    public CreationHelper getCreationHelper()

  Description copied from interface: `Workbook`
  Returns an object that handles instantiating concrete classes of the various instances one needs for HSSF and XSSF.

  Specified by:
    `getCreationHelper` in interface `Workbook`

### getNameXPtg

    public NameXPtg getNameXPtg(java.lang.String name)

  Note - This method should only used by POI internally. It may get deleted or change definition in future POI versions

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2010 The Apache Software Foundation or its licensors, as applicable.