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.xssf.usermodel
Class XSSFWorkbook

    java.lang.Object
      org.apache.poi.POIXMLDocumentPart
          org.apache.poi.POIXMLDocument
              org.apache.poi.xssf.usermodel.XSSFWorkbook

All Implemented Interfaces:
  org.apache.poi.ss.usermodel.Workbook, poi.support.Iterable

    public class XSSFWorkbook

extends POIXMLDocument
implements org.apache.poi.ss.usermodel.Workbook, poi.support.Iterable

High level representation of a SpreadsheetML 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.

Field Summary
`static float` | `DEFAULT_CHARACTER_WIDTH` Width of one character of the default font in pixels.
`static int` | `PICTURE_TYPE_BMP`
`static int` | `PICTURE_TYPE_EPS`
`static int` | `PICTURE_TYPE_GIF` Images formats supported by XSSF but not by HSSF
`static int` | `PICTURE_TYPE_TIFF`
`static int` | `PICTURE_TYPE_WPG`

Fields inherited from class org.apache.poi.POIXMLDocument
`DOCUMENT_CREATOR, OLE_OBJECT_REL_TYPE, PACK_OBJECT_REL_TYPE`

Fields inherited from class org.apache.poi.POIXMLDocumentPart
`DEFAULT_XML_OPTIONS`

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
`XSSFWorkbook()` Create a new SpreadsheetML workbook.
`XSSFWorkbook(java.io.InputStream is)`
`XSSFWorkbook(OPCPackage pkg)` Constructs a XSSFWorkbook object given a OpenXML4J `Package` object, see www.openxml4j.org.
`XSSFWorkbook(java.lang.String path)` Deprecated.

Method Summary
`int` | `addPicture(byte[] pictureData, int format)` Adds a picture to the workbook.
`int` | `addPicture(java.io.InputStream is, int format)` Adds a picture to the workbook.
`void` | `addToolPack(org.apache.poi.ss.formula.udf.UDFFinder toopack)` Register a new toolpack in this workbook.
`org.apache.poi.ss.usermodel.Sheet` | `cloneSheet(int sheetNum)` Create an XSSFSheet from an existing sheet in the XSSFWorkbook.
`org.apache.poi.ss.usermodel.CellStyle` | `createCellStyle()` Create a new XSSFCellStyle and add it to the workbook's style table
`org.apache.poi.ss.usermodel.DataFormat` | `createDataFormat()` Returns the instance of XSSFDataFormat for this workbook.
`org.apache.poi.ss.usermodel.Font` | `createFont()` Create a new Font and add it to the workbook's font table
`org.apache.poi.ss.usermodel.Name` | `createName()`
`org.apache.poi.ss.usermodel.Sheet` | `createSheet()` Create an XSSFSheet for this workbook, adds it to the sheets and returns the high level representation.
`org.apache.poi.ss.usermodel.Sheet` | `createSheet(java.lang.String sheetname)` Create a new sheet for this Workbook and return the high level representation.
`org.apache.poi.ss.usermodel.Font` | `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
`int` | `getActiveSheetIndex()` Convenience method to get the active sheet.
`java.util.List` | `getAllEmbedds()` Get the document's embedded files.
`java.util.List` | `getAllPictures()` Gets all pictures from the Workbook.
`CalculationChain` | `getCalculationChain()` Return the CalculationChain object for this workbook
`org.apache.poi.ss.usermodel.CellStyle` | `getCellStyleAt(short idx)` gGet the cell style object at the given index
`org.apache.poi.ss.usermodel.CreationHelper` | `getCreationHelper()` Returns an object that handles instantiating concrete classes of the various instances for XSSF.
`org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook` | `getCTWorkbook()` Return the underlying XML bean
`java.util.Collection` | `getCustomXMLMappings()`
`int` | `getFirstVisibleTab()` Gets the first tab that is displayed in the list of tabs in excel.
`org.apache.poi.ss.usermodel.Font` | `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.
`MapInfo` | `getMapInfo()`
`org.apache.poi.ss.usermodel.Row.MissingCellPolicy` | `getMissingCellPolicy()` Retrieves the current policy on what to do when getting missing or blank cells from a row.
`org.apache.poi.ss.usermodel.Name` | `getName(java.lang.String name)`
`org.apache.poi.ss.usermodel.Name` | `getNameAt(int nameIndex)`
`int` | `getNameIndex(java.lang.String name)` Gets the named range index by his name Note:Excel named ranges are case-insensitive and this method performs a case-insensitive search.
`short` | `getNumberOfFonts()` Get the number of fonts in the this workbook
`int` | `getNumberOfNames()` Get the number of named ranges in the this workbook
`int` | `getNumberOfSheets()` Get the number of worksheets in the this workbook
`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.
`SharedStringsTable` | `getSharedStringSource()` Returns SharedStringsTable - tha cache of string for this workbook
`org.apache.poi.ss.usermodel.Sheet` | `getSheet(java.lang.String name)` Get sheet with the given name (case insensitive match)
`org.apache.poi.ss.usermodel.Sheet` | `getSheetAt(int index)` Get the XSSFSheet object at the given index.
`int` | `getSheetIndex(org.apache.poi.ss.usermodel.Sheet sheet)` Returns the index of the given sheet
`int` | `getSheetIndex(java.lang.String name)` Returns the index of the sheet by his name (case insensitive match)
`java.lang.String` | `getSheetName(int sheetIx)` Get the sheet name
`StylesTable` | `getStylesSource()` Return a object representing a collection of shared objects used for styling content, e.g.
`ThemesTable` | `getTheme()` Returns the Theme of current workbook.
`boolean` | `isHidden()`
`boolean` | `isMacroEnabled()` Are we a normal workbook (.xlsx), or a macro enabled workbook (.xlsm)?
`boolean` | `isRevisionLocked()` Specifies a boolean value that indicates whether the workbook is locked for revisions.
`boolean` | `isSheetHidden(int sheetIx)` Check whether a sheet is hidden.
`boolean` | `isSheetVeryHidden(int sheetIx)` Check whether a sheet is very hidden.
`boolean` | `isStructureLocked()` Specifies a boolean value that indicates whether structure of workbook is locked.
`boolean` | `isWindowsLocked()` Specifies a boolean value that indicates whether the windows that comprise the workbook are locked.
`java.util.Iterator` | `iterator()` Allows foreach loops:
`void` | `lockRevision()` Locks the workbook for revisions.
`void` | `lockStructure()` Locks the structure of workbook.
`void` | `lockWindows()` Locks the windows that comprise the workbook.
`void` | `removeName(int nameIndex)`
`void` | `removeName(java.lang.String 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.
`void` | `setActiveSheet(int index)` Convenience method to set the active sheet.
`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(org.apache.poi.ss.usermodel.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.
`void` | `setSelectedTab(int index)` We only set one sheet as selected for compatibility with HSSF.
`void` | `setSheetHidden(int sheetIx, boolean hidden)` Sets the visible state of this sheet.
`void` | `setSheetHidden(int sheetIx, int state)` Hide or unhide a sheet.
`void` | `setSheetName(int sheetIndex, java.lang.String sheetname)` Set the sheet name.
`void` | `setSheetOrder(java.lang.String sheetname, int pos)` sets the order of appearance for a given sheet.
`void` | `unLockRevision()` Unlocks the workbook for revisions.
`void` | `unLockStructure()` Unlocks the structure of workbook.
`void` | `unLockWindows()` Unlocks the windows that comprise the workbook.

Methods inherited from class org.apache.poi.POIXMLDocument
`getPackage, getProperties, hasOOXMLHeader, openPackage, write`

Methods inherited from class org.apache.poi.POIXMLDocumentPart
`addRelation, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelationById, getRelationId, getRelations, toString`

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

Methods inherited from interface org.apache.poi.ss.usermodel.Workbook
`write`

Field Detail

### DEFAULT_CHARACTER_WIDTH

    public static final float DEFAULT_CHARACTER_WIDTH

  Width of one character of the default font in pixels. Same for Calibry and Arial.

  See Also:
    Constant Field Values

### PICTURE_TYPE_GIF

    public static final int PICTURE_TYPE_GIF

  Images formats supported by XSSF but not by HSSF

  See Also:
    Constant Field Values

### PICTURE_TYPE_TIFF

    public static final int PICTURE_TYPE_TIFF

See Also:
  Constant Field Values

### PICTURE_TYPE_EPS

    public static final int PICTURE_TYPE_EPS

See Also:
  Constant Field Values

### PICTURE_TYPE_BMP

    public static final int PICTURE_TYPE_BMP

See Also:
  Constant Field Values

### PICTURE_TYPE_WPG

    public static final int PICTURE_TYPE_WPG

See Also:
  Constant Field Values

Constructor Detail

### XSSFWorkbook

    public XSSFWorkbook()

  Create a new SpreadsheetML workbook.

### XSSFWorkbook

    public XSSFWorkbook(OPCPackage pkg)
                 throws java.io.IOException

  Constructs a XSSFWorkbook object given a OpenXML4J `Package` object, see www.openxml4j.org.

  Parameters:
    `pkg` - the OpenXML4J `Package` object.
  Throws:
    `java.io.IOException`

### XSSFWorkbook

    public XSSFWorkbook(java.io.InputStream is)
                 throws java.io.IOException

Throws:
  `java.io.IOException`

### XSSFWorkbook

    public XSSFWorkbook(java.lang.String path)
                 throws java.io.IOException

  Deprecated.

  Constructs a XSSFWorkbook object given a file name.

  This constructor is deprecated since POI-3.8 because it does not close the underlying .zip file stream. In short, there are two ways to open a OPC package:

  1. from file which leads to invoking java.util.zip.ZipFile(File file) deep in POI internals.
  2. from input stream in which case we first read everything into memory and then pass the data to ZipInputStream.

  It should be noted, that (2) uses quite a bit more memory than (1), which doesn't need to hold the whole zip file in memory, and can take advantage of native methods.

  To construct a workbook from file use the `XSSFWorkbook(org.apache.poi.openxml4j.opc.OPCPackage)` constructor:

             OPCPackage pkg = OPCPackage.open(path);
             XSSFWorkbook wb = new XSSFWorkbook(pkg);
             // work with the wb object
             ......
             pkg.close(); // gracefully closes the underlying zip file

  Parameters:
    `path` - the file name.
  Throws:
    `java.io.IOException`

Method Detail

### getCTWorkbook

    public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook getCTWorkbook()

  Return the underlying XML bean

  Returns:
    the underlying CTWorkbook bean

### addPicture

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

  Adds a picture to the workbook.

  Specified by:
    `addPicture` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `pictureData` - The bytes of the picture
    `format` - The format of the picture.
  Returns:
    the index to this picture (0 based), the added picture can be obtained from `getAllPictures()` .
  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()`

### addPicture

    public int addPicture(java.io.InputStream is,
                          int format)
                   throws java.io.IOException

  Adds a picture to the workbook.

  Parameters:
    `is` - The sream to read image from
    `format` - The format of the picture.
  Returns:
    the index to this picture (0 based), the added picture can be obtained from `getAllPictures()` .
  Throws:
    `java.io.IOException`
  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()`

### cloneSheet

    public org.apache.poi.ss.usermodel.Sheet cloneSheet(int sheetNum)

  Create an XSSFSheet from an existing sheet in the XSSFWorkbook. The cloned sheet is a deep copy of the original.

  Specified by:
    `cloneSheet` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    XSSFSheet representing the cloned sheet.
  Throws:
    `java.lang.IllegalArgumentException` - if the sheet index in invalid
    `POIXMLException` - if there were errors when cloning

### createCellStyle

    public org.apache.poi.ss.usermodel.CellStyle createCellStyle()

  Create a new XSSFCellStyle and add it to the workbook's style table

  Specified by:
    `createCellStyle` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    the new XSSFCellStyle object

### createDataFormat

    public org.apache.poi.ss.usermodel.DataFormat createDataFormat()

  Returns the instance of XSSFDataFormat for this workbook.

  Specified by:
    `createDataFormat` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    the XSSFDataFormat object
  See Also:
    `DataFormat`

### createFont

    public org.apache.poi.ss.usermodel.Font createFont()

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

  Specified by:
    `createFont` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    new font object

### createName

    public org.apache.poi.ss.usermodel.Name createName()

  Specified by:
    `createName` in interface `org.apache.poi.ss.usermodel.Workbook`

### createSheet

    public org.apache.poi.ss.usermodel.Sheet createSheet()

  Create an XSSFSheet for this workbook, adds it to the sheets and returns the high level representation. Use this to create new sheets.

  Specified by:
    `createSheet` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    XSSFSheet representing the new sheet.

### createSheet

    public org.apache.poi.ss.usermodel.Sheet createSheet(java.lang.String sheetname)

  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.

  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:

  - 0x0000
  - 0x0003
  - colon (:)
  - backslash (\)
  - asterisk (*)
  - question mark (?)
  - forward slash (/)
  - opening square bracket ([)
  - closing square bracket (])
  The string MUST NOT begin or end with the single quote (') character.

  See `WorkbookUtil.createSafeSheetName(String nameProposal)` for a safe way to create valid names

  Specified by:
    `createSheet` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `sheetname` - sheetname to set for the sheet.
  Returns:
    Sheet representing the new sheet.
  Throws:
    `java.lang.IllegalArgumentException` - if the name is null or invalid or workbook already contains a sheet with this name
  See Also:
    `WorkbookUtil.createSafeSheetName(String nameProposal)`

### findFont

    public org.apache.poi.ss.usermodel.Font 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 `org.apache.poi.ss.usermodel.Workbook`

### getActiveSheetIndex

    public int getActiveSheetIndex()

  Convenience method to get 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:
    `getActiveSheetIndex` in interface `org.apache.poi.ss.usermodel.Workbook`

### getAllPictures

    public java.util.List getAllPictures()

  Gets all pictures from the Workbook.

  Specified by:
    `getAllPictures` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    the list of pictures (a list of `XSSFPictureData` objects.)
  See Also:
    `addPicture(byte[], int)`

### getCellStyleAt

    public org.apache.poi.ss.usermodel.CellStyle getCellStyleAt(short idx)

  gGet the cell style object at the given index

  Specified by:
    `getCellStyleAt` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `idx` - index within the set of styles
  Returns:
    XSSFCellStyle object at the index

### getFontAt

    public org.apache.poi.ss.usermodel.Font getFontAt(short idx)

  Get the font at the given index number

  Specified by:
    `getFontAt` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `idx` - index number
  Returns:
    XSSFFont at the index

### getName

    public org.apache.poi.ss.usermodel.Name getName(java.lang.String name)

  Specified by:
    `getName` in interface `org.apache.poi.ss.usermodel.Workbook`

### getNameAt

    public org.apache.poi.ss.usermodel.Name getNameAt(int nameIndex)

  Specified by:
    `getNameAt` in interface `org.apache.poi.ss.usermodel.Workbook`

### getNameIndex

    public int getNameIndex(java.lang.String name)

  Gets the named range index by his name Note:Excel named ranges are case-insensitive and this method performs a case-insensitive search.

  Specified by:
    `getNameIndex` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `name` - named range name
  Returns:
    named range index

### getNumCellStyles

    public short getNumCellStyles()

  Get the number of styles the workbook contains

  Specified by:
    `getNumCellStyles` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    count of cell styles

### getNumberOfFonts

    public short getNumberOfFonts()

  Get the number of fonts in the this workbook

  Specified by:
    `getNumberOfFonts` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    number of fonts

### getNumberOfNames

    public int getNumberOfNames()

  Get the number of named ranges in the this workbook

  Specified by:
    `getNumberOfNames` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    number of named ranges

### getNumberOfSheets

    public int getNumberOfSheets()

  Get the number of worksheets in the this workbook

  Specified by:
    `getNumberOfSheets` in interface `org.apache.poi.ss.usermodel.Workbook`
  Returns:
    number of worksheets

### 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 `org.apache.poi.ss.usermodel.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

### getSheet

    public org.apache.poi.ss.usermodel.Sheet getSheet(java.lang.String name)

  Get sheet with the given name (case insensitive match)

  Specified by:
    `getSheet` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `name` - of the sheet
  Returns:
    XSSFSheet with the name provided or `null` if it does not exist

### getSheetAt

    public org.apache.poi.ss.usermodel.Sheet getSheetAt(int index)

  Get the XSSFSheet object at the given index.

  Specified by:
    `getSheetAt` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `index` - of the sheet number (0-based physical & logical)
  Returns:
    XSSFSheet at the provided index
  Throws:
    `java.lang.IllegalArgumentException` - if the index is out of range (index < 0 || index >= getNumberOfSheets()).

### getSheetIndex

    public int getSheetIndex(java.lang.String name)

  Returns the index of the sheet by his name (case insensitive match)

  Specified by:
    `getSheetIndex` in interface `org.apache.poi.ss.usermodel.Workbook`
  Parameters:
    `name` - the sheet name
  Returns:
    index of the sheet (0 based) or `-1`

  ### getSheetIndex

      public int getSheetIndex(org.apache.poi.ss.usermodel.Sheet sheet)

    Returns the index of the given sheet

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

  ### getSheetName

      public java.lang.String getSheetName(int sheetIx)

    Get the sheet name

    Specified by:
      `getSheetName` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIx` - Number
    Returns:
      Sheet name

  ### iterator

      public java.util.Iterator iterator()

    Allows foreach loops:

         XSSFWorkbook wb = new XSSFWorkbook(package);
         for(XSSFSheet sheet : wb){

         }

    Specified by:
      `iterator` in interface `poi.support.Iterable`

  ### isMacroEnabled

      public boolean isMacroEnabled()

    Are we a normal workbook (.xlsx), or a macro enabled workbook (.xlsm)?

  ### removeName

      public void removeName(int nameIndex)

    Specified by:
      `removeName` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### removeName

      public void removeName(java.lang.String name)

    Specified by:
      `removeName` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### removePrintArea

      public void removePrintArea(int sheetIndex)

    Delete the printarea for the sheet specified

    Specified by:
      `removePrintArea` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIndex` - 0-based sheet index (0 = First Sheet)

  ### 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 `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `index` - of the sheet (0-based)

  ### getMissingCellPolicy

      public org.apache.poi.ss.usermodel.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 `org.apache.poi.ss.usermodel.Workbook`

  ### setMissingCellPolicy

      public void setMissingCellPolicy(org.apache.poi.ss.usermodel.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 `Row.getCell(int)`}. See `Row.MissingCellPolicy`

    Specified by:
      `setMissingCellPolicy` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### 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 `org.apache.poi.ss.usermodel.Workbook`

  ### getFirstVisibleTab

      public int getFirstVisibleTab()

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

    Specified by:
      `getFirstVisibleTab` in interface `org.apache.poi.ss.usermodel.Workbook`
    Returns:
      integer that contains the index to the active sheet in this book view.

  ### 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 `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `index` - integer that contains the index to the active sheet in this book view.

  ### 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 `org.apache.poi.ss.usermodel.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 `org.apache.poi.ss.usermodel.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)`

  ### setRepeatingRowsAndColumns

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

    Sets the repeating rows and columns for a sheet.

    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 `org.apache.poi.ss.usermodel.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.

  ### setSelectedTab

      public void setSelectedTab(int index)

    We only set one sheet as selected for compatibility with HSSF.

    Specified by:
      `setSelectedTab` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### setSheetName

      public void setSheetName(int sheetIndex,
                               java.lang.String sheetname)

    Set the sheet name.

    Specified by:
      `setSheetName` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIndex` - sheet number (0 based)
      `sheetname` - the new sheet name
    Throws:
      `java.lang.IllegalArgumentException` - if the name is null or invalid or workbook already contains a sheet with this name
    See Also:
      `createSheet(String)`, `WorkbookUtil.createSafeSheetName(String nameProposal)`

  ### setSheetOrder

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

    sets the order of appearance for a given sheet.

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

  ### getSharedStringSource

      public SharedStringsTable getSharedStringSource()

    Returns SharedStringsTable - tha cache of string for this workbook

    Returns:
      the shared string table

  ### getStylesSource

      public StylesTable getStylesSource()

    Return a object representing a collection of shared objects used for styling content, e.g. fonts, cell styles, colors, etc.

  ### getTheme

      public ThemesTable getTheme()

    Returns the Theme of current workbook.

  ### getCreationHelper

      public org.apache.poi.ss.usermodel.CreationHelper getCreationHelper()

    Returns an object that handles instantiating concrete classes of the various instances for XSSF.

    Specified by:
      `getCreationHelper` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### getAllEmbedds

      public java.util.List getAllEmbedds()
                                   throws OpenXML4JException

    Get the document's embedded files.

    Specified by:
      `getAllEmbedds` in class `POIXMLDocument`
    Throws:
      `OpenXML4JException`

  ### isHidden

      public boolean isHidden()

    Specified by:
      `isHidden` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### setHidden

      public void setHidden(boolean hiddenFlag)

    Specified by:
      `setHidden` in interface `org.apache.poi.ss.usermodel.Workbook`

  ### isSheetHidden

      public boolean isSheetHidden(int sheetIx)

    Check whether a sheet is hidden.

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

    Specified by:
      `isSheetHidden` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIx` - Number
    Returns:
      `true` if sheet is hidden

  ### isSheetVeryHidden

      public boolean isSheetVeryHidden(int sheetIx)

    Check whether a sheet is very hidden.

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

    Specified by:
      `isSheetVeryHidden` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIx` - sheet index to check
    Returns:
      `true` if sheet is very hidden

  ### setSheetHidden

      public void setSheetHidden(int sheetIx,
                                 boolean hidden)

    Sets the visible state of this sheet.

    Calling `setSheetHidden(sheetIndex, true)` is equivalent to `setSheetHidden(sheetIndex, Workbook.SHEET_STATE_HIDDEN)`.
    Calling `setSheetHidden(sheetIndex, false)` is equivalent to `setSheetHidden(sheetIndex, Workbook.SHEET_STATE_VISIBLE)`.

    Specified by:
      `setSheetHidden` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIx` - the 0-based index of the sheet
      `hidden` - whether this sheet is hidden
    See Also:
      `setSheetHidden(int, int)`

  ### setSheetHidden

      public void setSheetHidden(int sheetIx,
                                 int state)

    Hide or unhide a sheet.
    - 0 - visible.
    - 1 - hidden.
    - 2 - very hidden.

    Specified by:
      `setSheetHidden` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `sheetIx` - the sheet index (0-based)
      `state` - one of the following `Workbook` constants: `Workbook.SHEET_STATE_VISIBLE`, `Workbook.SHEET_STATE_HIDDEN`, or `Workbook.SHEET_STATE_VERY_HIDDEN`.
    Throws:
      `java.lang.IllegalArgumentException` - if the supplied sheet index or state is invalid

  ### getCalculationChain

      public CalculationChain getCalculationChain()

    Return the CalculationChain object for this workbook

    The calculation chain object specifies the order in which the cells in a workbook were last calculated

    Returns:
      the `CalculationChain` object or `null` if not defined

  ### getCustomXMLMappings

      public java.util.Collection getCustomXMLMappings()

    Returns:
      a collection of custom XML mappings defined in this workbook

  ### getMapInfo

      public MapInfo getMapInfo()

    Returns:
      the helper class used to query the custom XML mapping defined in this workbook

  ### isStructureLocked

      public boolean isStructureLocked()

    Specifies a boolean value that indicates whether structure of workbook is locked.
    A value true indicates the structure of the workbook is locked. Worksheets in the workbook can't be moved, deleted, hidden, unhidden, or renamed, and new worksheets can't be inserted.
    A value of false indicates the structure of the workbook is not locked.

    Returns:
      true if structure of workbook is locked

  ### isWindowsLocked

      public boolean isWindowsLocked()

    Specifies a boolean value that indicates whether the windows that comprise the workbook are locked.
    A value of true indicates the workbook windows are locked. Windows are the same size and position each time the workbook is opened.
    A value of false indicates the workbook windows are not locked.

    Returns:
      true if windows that comprise the workbook are locked

  ### isRevisionLocked

      public boolean isRevisionLocked()

    Specifies a boolean value that indicates whether the workbook is locked for revisions.

    Returns:
      true if the workbook is locked for revisions.

  ### lockStructure

      public void lockStructure()

    Locks the structure of workbook.

  ### unLockStructure

      public void unLockStructure()

    Unlocks the structure of workbook.

  ### lockWindows

      public void lockWindows()

    Locks the windows that comprise the workbook.

  ### unLockWindows

      public void unLockWindows()

    Unlocks the windows that comprise the workbook.

  ### lockRevision

      public void lockRevision()

    Locks the workbook for revisions.

  ### unLockRevision

      public void unLockRevision()

    Unlocks the workbook for revisions.

  ### addToolPack

      public void addToolPack(org.apache.poi.ss.formula.udf.UDFFinder toopack)

    Register a new toolpack in this workbook.

    Specified by:
      `addToolPack` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `toopack` - the toolpack to register

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

    Specified by:
      `setForceFormulaRecalculation` in interface `org.apache.poi.ss.usermodel.Workbook`
    Parameters:
      `value` - true if the application will perform a full recalculation of workbook values when the workbook is opened
    Since:
      3.8

  ### getForceFormulaRecalculation

      public boolean getForceFormulaRecalculation()

    Whether Excel will be asked to recalculate all formulas when the workbook is opened.

    Specified by:
      `getForceFormulaRecalculation` in interface `org.apache.poi.ss.usermodel.Workbook`
    Since:
      3.8

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