com.f1j.ss
Class BookImpl

java.lang.Object
  |
  +--com.actuate.util.Debug
        |
        +--com.f1j.util.Debug
              |
              +--com.f1j.util.ObjConst
                    |
                    +--com.f1j.util.Obj
                          |
                          +--com.f1j.util.SharedHelper
                                |
                                +--com.f1j.util.SharedObj
                                      |
                                      +--com.f1j.util.SharedHintedObj
                                            |
                                            +--com.f1j.mvc.ModelImpl
                                                  |
                                                  +--com.f1j.mvc.ModelImplEx
                                                        |
                                                        +--com.f1j.ss.BookImpl

public class BookImpl
extends com.f1j.mvc.ModelImplEx
implements Book, Constants, java.lang.Runnable

This class implements the low level model for an e.Spreadsheet workbook. A workbook contains an array of sheets, as well as information which applies to the entire workbook.


Field Summary
static short eClearAll
          Clears data, formats, and objects.
static short eClearContents
          Clears cell data but leaves formatting intact.
static short eClearDlg
          Displays the Clear dialog box.
static short eClearFormats
          Clears formats only.
static short eClearValues
          Deprecated. Replaced by #eClearContents
static short eColWidthUnitsNormal
          Column width in characters.
static short eColWidthUnitsTwips
          Column width in twips.
static short eCopyAll
          Copies formats, values, and formulas.
static short eCopyFormats
          Copies formats.
static short eCopyFormulas
          Copies formulas and data.
static short eCopyValues
          Copies the values only; the result is a value without the formula that produced it.
static short eEncryptionAuto
          Deprecated. Replaced by DocumentEncryption.AUTO
static short eEncryptionExcel97
          Deprecated. Replaced by DocumentEncryption.EXCEL97
static short eEncryptionWeak
          Deprecated. Replaced by DocumentEncryption.WEAK
static short eFileActuate9
          Deprecated. Replaced by DocumentType.ACTUATE_9_WORKBOOK
static short eFileCurrentFormat
          Deprecated. Replaced by DocumentType.CURRENT_FORMAT
static short eFileESpreadsheet11
          Deprecated. Replaced by DocumentType.ESPREADSHEET_11_WORKBOOK
static short eFileExcel5
          Deprecated. Replaced by DocumentType.EXCEL_5_WORKBOOK
static short eFileExcel97
          Deprecated. Replaced by DocumentType.EXCEL_97_WORKBOOK
static short eFileExcel97And5
          Excel 97-2003 and 5.x/95 format.
static short eFileFormulaOne3
          Deprecated. Replaced by DocumentType.FORMULA_ONE_3_WORKBOOK
static short eFileFormulaOne6
          Deprecated. Replaced by DocumentType.FORMULA_ONE_6_WORKBOOK
static short eFileFormulaOne7
          Deprecated. Replaced by DocumentType.FORMULA_ONE_7_WORKBOOK
static short eFileTabbedText
          Deprecated. Replaced by DocumentType.TABBED_TEXT
static short eFileTabbedTextValuesOnly
          Deprecated. Replaced by DocumentType.TABBED_TEXT_VALUES_ONLY
static short eFileUnicodeText
          Deprecated. Replaced by DocumentType.UNICODE_TEXT
static short eFileUnicodeTextValuesOnly
          Deprecated. Replaced by DocumentType.UNICODE_TEXT_VALUES_ONLY
static short eFixupAppend
          Append cells to a range during an insert.
static short eFixupIgnoreAdjacentRanges
          Ignore Adjacent Ranges
static short eFixupPrepend
          Prepend cells to a range during an insert.
static short eOutlineCollapsed
          Collapsed rows/columns in an outline.
static short eOutlineExpanded
          Expanded rows/columns in an outline.
static short eOutlineTerminal
          Terminals or leaf node rows/columns in an outline.
static short eParamCurrency
          Parameter Type - Currency
static short eParamDate
          Parameter Type - Date
static short eParamDouble
          Parameter Type - double
static short eParametersFileActuate5
          Deprecated. e.Spreadsheet 12 and up no longer write ROP files.
static short eParametersFileActuate6
          Deprecated. e.Spreadsheet 12 and up no longer write ROP files.
static short eParametersFileActuate7
          Deprecated. e.Spreadsheet 12 and up no longer write ROP files.
static short eParametersFileActuate8
          Deprecated. e.Spreadsheet 12 and up no longer write ROP files.
static short eParamFormula
          Parameter Type - Formula
static short eParamInteger
          Parameter Type - Integer
static short eParamString
          Parameter Type - String
static short eQueryParamCurrency
          Parameter Type - Currency
static short eQueryParamDate
          Parameter Type - Date
static short eQueryParamDouble
          Parameter Type - double
static short eQueryParamFormula
          Parameter Type - Formula
static short eQueryParamInteger
          Parameter Type - Integer
static short eQueryParamString
          Parameter Type - String
static short eSheetHidden
          Indicates the sheet is hidden.
static short eSheetShown
          Indicates the sheet is not hidden.
static short eSheetTypeChart
          Chartsheet sheet type.
static short eSheetTypeSheet
          Worksheet sheet type.
static short eSheetVeryHidden
          Indicates the sheet is hidden and the user is not allowed to unhide it via the Workbook Designer.
static short eShiftColumns
          Columns in which the range resides are deleted.
static short eShiftHorizontal
          Cells to the right of the range are shifted left to fill the vacated space.
static short eShiftRows
          Rows in which the range resides are deleted.
static short eShiftVertical
          Cells below the range are shifted up to fill the vacated space.
static short eShowAutomatic
          Selections or scroll bars are displayed if book or control is active.
static short eShowOff
          Selections or scrollbars are hidden.
static short eShowOn
          Selections or scrollbars are displayed.
static short eTabsBottom
          Tabs appear at the bottom of worksheets.
static short eTabsOff
          Tabs do not appear on worksheets.
static short eTabsTop
          Tabs appear at the top of worksheets.
static short eTypeEmpty
          Indicates an empty cell.
static short eTypeError
          Indicates the cell contains an error.
static short eTypeLogical
          Indicates a logical cell.
static short eTypeNumber
          Indicates a number cell.
static short eTypeText
          Indicates a text cell.
static int kAllowDefault
          Sheet protection allows default standard operations.
static int kAllowDeleteColumns
          Sheet protection allows Delete columns.
static int kAllowDeleteRows
          Sheet protection allows Delete rows.
static int kAllowEditObjects
          Sheet protection allows Edit objects.
static int kAllowFormatCells
          Sheet protection allows Format cells.
static int kAllowFormatColumns
          Sheet protection allows Format columns.
static int kAllowFormatRows
          Sheet protection allows Format rows.
static int kAllowInsertColumns
          Sheet protection allows Insert columns.
static int kAllowInsertHyperlinks
          Sheet protection allows Insert hyperlinks.
static int kAllowInsertRows
          Sheet protection allows Insert rows.
static int kAllowNone
          Sheet protection allows nothing.
static int kAllowSelectLocked
          Sheet protection allows Select locked cells.
static int kAllowSelectUnlocked
          Sheet protection allows Select unlocked cells.
static int kAllowSort
          Sheet protection allows Sort.
static int kAllowUseAutoFilter
          Sheet protection allows Use AutoFilter.
static int kAllowUsePivotRanges
          Sheet protection allows Use PivotRange reports.
static int kCodePageDefaultANSI
          default ANSI (language-specific) code page.
static int kCodePageUnicodeBE
          Unicode Big Endian (UTF-16) code page.
static int kCodePageUnicodeLE
          Unicode Little Endian (UTF-16) code page.
static int kCodePageUTF8
          UTF-8 code page.
static int kContentsChanged
          Cell contents were changed in an entry method.
static int kFontChanged
          Font was changed in an entry method.
static int kFormatChanged
          Format was changed in an entry method.
static int kMaxCellText
          The maximum length of text in a cell.
static int kMaxCol
          The maximum column number.
static int kMaxCols
          The maximum number of columns.
static int kMaxPaletteEntry
          The maximum number of palatte entries.
static int kMaxRow
          The maximum row number.
static int kMaxRows
          The maximum number of rows.
static int kMaxSheet
          The maximum sheet number.
static int kMaxSheets
          The maximum number of sheets.
static int kProtectStructure
          Workbook structure is protected.
 
Constructor Summary
BookImpl()
          Constructs a new uninitialized workbook.
BookImpl(Group group)
          Constructs a new uninitialized workbook and makes it part of the specified group.
 
Method Summary
 void checkRecalc()
          Recalculates the workbook, if needed.
 void copyAll(Book srcBook)
          Copies the contents of one workbook to another workbook.
 void copySheet(int insertAt, BookView bookView)
          Creates copies of all sheets selected in the specified view.
 void copySheet(int insertAt, Range rangeAPI)
          Creates copies of the specified sheets.
 DataBase createDatabase()
          Creates a new Database object.
 void deleteDefinedName(java.lang.String name)
          Deletes the specified user-defined name.
 void deleteSheet(BookView bookView)
          Deletes the sheets selected in the specified view.
 void deleteSheet(Range rangeAPI)
          Deletes the specified sheets.
 void deleteSheets(int nDeleteAt, int nSheets)
          Deletes one or more worksheets from a workbook

The names displayed on the sheet tabs are not affected by the deletions; however, the worksheet index is adjusted.

 Book findBook(java.lang.String bookName)
          Attempts to find a workbook with the specified name in the same group as this workbook.
 void forceRecalc()
          Marks all formulas in the workbook as needing to be recalculated.
 java.lang.String formatRCNr(int row, int col, boolean bAbsRow, boolean bAbsCol)
          Formats a row and column number as text.
 void gc(boolean collectFormats, boolean collectFormulas)
          Performs garbage collection on formatting and/or formula information associated with a workbook.
 CellFormat getCellFormat(int sheet1, int row1, int col1, int sheet2, int row2, int col2)
          Returns the format of the specified range of cells in the specified range of sheets.
 java.lang.String getCodeName()
          Returns the VBA object name assigned to this workbook.
 short getColWidthUnits()
          Returns whether column widths are stored and displayed in twips or in character units.
 DataSet getDefaultDataSet()
          Returns the default DataSet for this book.
 java.lang.String getDefinedName(java.lang.String name, int row, int col)
          Returns the definition associated with a defined name given the offset provided by the row and column parameters.
 int getDefinedNameCount()
          Returns the number of defined names in a view.
 Document getDocument()
          Returns the Document object associated with this book.
 java.lang.String getGroupName()
          Returns the Group name for this Book.
 java.lang.String getHyperlinkBase()
          Returns the hyperlink base string used for relative hyperlinks.
 int getIterationMax()
          Returns the maximum number of calculation iterations.
 double getIterationMaxChange()
          Returns the maximum iteration change value.
 long getModifiedCount()
          Returns the modified count of this workbook.
 java.lang.String getName()
          Returns the name assigned to this workbook.
 PivotGroup getPivotGroup()
          Returns a reference to the PivotRange group.
 int getProtectionFlags()
          Returns a set of flags indicating which actions are protected on this workbook when protection is enabled.
 ReadResults getReadResults()
          Deprecated. Replaced by Document.getDocumentSaveOptions(), Document.getDocumentType()
 ReportFunctionsGroup getReportFunctionsGroup()
          Returns a reference to the ReportFunctionsGroup.
 Sheet getSheet(int sheet)
          Returns the Sheet at the specified index.
 int getSheetCount()
          Returns the number of worksheets in this workbook.
 int getVersion()
          Returns the version of the component.
 java.lang.String getVersionString()
          Returns the version of the component in a string.
 boolean hasPivotGroup()
          Returns true if the book has a PivotRange group.
 boolean hasReportFunctionsGroup()
          Returns true if the book has a ReportFunctionsGroup.
 void initBook()
          Initilaizes a workbook to a default, empty state.
 void insertSheet(BookView bookView)
          Inserts one or more sheets before the active sheet of the specified view.
 void insertSheets(int nInsertAt, int nSheets)
          Inserts one or more worksheets at the specified location.
 boolean isAutoRecalc()
          Returns whether or not automatic recalc is on.
 boolean isColWidthInTwips()
          Returns whether column widths are stored in twips for this workbook.
 boolean isIterationEnabled()
          Returns true if iteration is enabled.
 boolean isPasswordProtected()
          Returns true if protection is enabled with a password for this workbook.
 boolean isPrecisionAsDisplayed()
          Returns true if all cell values are rounded to the displayed precision.
 boolean isProhibited(int protectionFlags)
          Returns true if the workbook is protected and the workbook's current protection settings include the specified flags.
 boolean isProtected()
          Returns true if protection is enabled for this workbook.
 void moveSheet(int insertAt, BookView bookView)
          Moves all sheets selected in the specified view, to a specified location.
 void moveSheet(int insertAt, Range rangeAPI)
          Moves the specified sheets to a specified location.
 short read(byte[] blob)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, byte[], DocumentOpenCallback)
 ReadResults read(byte[] blob, com.f1j.ss.ReadParams rp)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, byte[], DocumentOpenCallback)
 short read(java.io.InputStream inputStream)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.InputStream, DocumentOpenCallback)
 ReadResults read(java.io.InputStream inputStream, com.f1j.ss.ReadParams rp)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.InputStream, DocumentOpenCallback)
 short read(java.io.InputStream inputStream, short eCodePage)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.InputStream, DocumentOpenCallback)
 short read(java.lang.String fileName)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.File, boolean, DocumentOpenCallback)
 ReadResults read(java.lang.String fileName, com.f1j.ss.ReadParams rp)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.File, boolean, DocumentOpenCallback)
 short readFromBlob(byte[] blob)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, byte[], DocumentOpenCallback)
 ReadResults readFromBlob(byte[] blob, com.f1j.ss.ReadParams rp)
          Deprecated. Replaced by Document.Document(com.f1j.util.Group, byte[], DocumentOpenCallback)
 void recalc()
          Recalculates this workbook.
 void setAutoRecalc(boolean autoRecalc)
          Sets the flag that determines whether or not automatic recalc is on.
 void setCodeName(java.lang.String codeName)
          Assigns a VBA object name to this workbook.
 void setDefaultDataSet(DataSet dataSet)
          Sets the default DataSet for this book.
 void setDefinedName(java.lang.String name, java.lang.String formula, int row, int col)
          Sets the formula associated with a defined name, in US English.
 void setDefinedName(java.lang.String name, java.lang.String formula, int row, int col, boolean param, boolean strip, short type)
          Sets the formula associated with a defined name, in US English.
 void setDefinedName(java.lang.String name, java.lang.String formula, Sheet sheet, int row, int col)
          Sets the formula associated with a defined name, in US English.
 void setDefinedName(java.lang.String name, java.lang.String formula, Sheet sheet, int row, int col, boolean param, boolean strip, short type)
          Sets the formula associated with a defined name, in US English.
 void setGroupName(java.lang.String group)
          Sets the group name for this workbook.
 void setHyperlinkBase(java.lang.String s)
          Sets the hyperlink base string - use null to turn off Book.
 void setIterationEnabled(boolean iterationEnabled)
          Sets whether iteration is enabled.
 void setIterationMax(int iterationMax)
          Sets the maximum number of iterations.
 void setIterationMaxChange(double iterationMaxChange)
          Sets the maximum iteration change value.
 void setName(java.lang.String name)
          Sets the name assigned to this workbook.
 void setNumSheets(int sheets)
          Sets the number of worksheets in this workbook.
 void setPrecisionAsDisplayed(boolean precisionAsDisplayed)
          Determines whether cell values are stored as entered or as displayed.
 void setProtection(boolean enableProtection, java.lang.String password, int flags)
          Sets whether protection is enabled for this workbook.
 boolean write(Sheet sheet, java.io.OutputStream stream, short eFileType)
          Deprecated. Replaced by Document.fileSaveCopyAs(java.io.OutputStream, DocumentType, DocumentSaveCallback)
 boolean write(Sheet sheet, java.io.OutputStream stream, short eFileType, short eCodePage)
          Deprecated. Replaced by Document.fileSaveCopyAs(java.io.OutputStream, DocumentType, DocumentSaveCallback)
 boolean write(Sheet sheet, java.io.OutputStream stream, com.f1j.ss.WriteParams wp)
          Deprecated. Replaced by Document.fileSaveCopyAs(java.io.OutputStream, DocumentType, DocumentSaveCallback)
 byte[] write(Sheet sheet, short eFileType)
          Deprecated. Replaced by Document.fileSaveCopyAsByteArray(DocumentType, DocumentSaveCallback)
 boolean write(Sheet sheet, java.lang.String pathName, short eFileType)
          Deprecated. Replaced by Document.fileSaveCopyAs(java.io.File, DocumentType, DocumentSaveCallback)
 boolean write(Sheet sheet, java.lang.String pathName, com.f1j.ss.WriteParams wp)
          Deprecated. Replaced by Document.fileSaveCopyAs(java.io.File, DocumentType, DocumentSaveCallback)
 byte[] write(Sheet sheet, com.f1j.ss.WriteParams wp)
          Deprecated. Replaced by Document.fileSaveCopyAsByteArray(DocumentType, DocumentSaveCallback)
 byte[] writeToBlob()
          Deprecated. Replaced by Document.fileSaveCopyAsByteArray(DocumentType, DocumentSaveCallback)
 byte[] writeToBlob(Sheet sheet, com.f1j.ss.WriteParams wp)
          Deprecated. Replaced by Document.fileSaveCopyAsByteArray(DocumentType, DocumentSaveCallback)
 boolean writeURL(Sheet sheet, java.net.URL url, com.f1j.ss.WriteParams wp)
          Deprecated. This method still works at this time, but in a future release e.Spreadsheet will no longer write to a URL.
 

Constructor Detail

BookImpl

public BookImpl()
Constructs a new uninitialized workbook.

The workbook must be initialized by calling the initBook method or by reading in a file before using it.

See Also:
Book.initBook(), Book.read(byte[]), Book.readFromBlob(byte[])

BookImpl

public BookImpl(Group group)
Constructs a new uninitialized workbook and makes it part of the specified group.

The workbook must be initialized by calling the initBook method or by reading in a file before using it.

Parameters:
group - the Group object to make this BookImpl part of. If the group parameter is null, a new Group is created.
See Also:
Book.initBook(), Book.read(byte[]), Book.readFromBlob(byte[])
Method Detail

getDocument

public Document getDocument()
Returns the Document object associated with this book.
Specified by:
getDocument in interface Book
Since:
12.0

checkRecalc

public void checkRecalc()
Recalculates the workbook, if needed.
Specified by:
checkRecalc in interface Book
See Also:
forceRecalc(), isAutoRecalc(), recalc(), setAutoRecalc(boolean)

copyAll

public void copyAll(Book srcBook)
             throws F1Exception
Copies the contents of one workbook to another workbook.
Parameters:
srcBook - a handle to the source workbook.
Throws:
F1Exception - if an error occurs
Specified by:
copyAll in interface Book

createDatabase

public DataBase createDatabase()
Creates a new Database object.
Specified by:
createDatabase in interface Book
See Also:
DataBase

deleteDefinedName

public void deleteDefinedName(java.lang.String name)
                       throws F1Exception
Deletes the specified user-defined name.
Parameters:
name - identifies the user-defined name to delete.
Throws:
F1Exception - if a parameter is invalid
Specified by:
deleteDefinedName in interface Book
See Also:
getDefinedName(java.lang.String, int, int), setDefinedName(java.lang.String, java.lang.String, int, int, boolean, boolean, short)

deleteSheets

public void deleteSheets(int nDeleteAt,
                         int nSheets)
                  throws F1Exception
Deletes one or more worksheets from a workbook

The names displayed on the sheet tabs are not affected by the deletions; however, the worksheet index is adjusted.

Parameters:
sheet - specifies the sheet index number of the first worksheet to delete. Do not confuse the sheet index number with the sheet name on the sheet tab.
sheets - specifies how many sheets to delete, beginning with the worksheet specified by the sheet parameter.
Throws:
F1Exception - if a parameter is invalid
Specified by:
deleteSheets in interface Book
See Also:
insertSheets(int, int)

deleteSheet

public void deleteSheet(BookView bookView)
                 throws SelectionException,
                        InvalidArgumentException,
                        AccessDeniedException

Deletes the sheets selected in the specified view.

Parameters:
bookView - The view whose active sheet is the insertion point for the new sheets.
Throws:
SelectionException - If all visible sheets in the workbook are selected.
InvalidArgumentException - if the specified BookView is not associated with this book.
AccessDeniedException - if the operation is not allowed due to workbook protection.
Specified by:
deleteSheet in interface Book
Since:
12.0
See Also:
insertSheet(BookView), deleteSheet(Range), BookModel.deleteSheet()

deleteSheet

public void deleteSheet(Range rangeAPI)
                 throws SelectionException,
                        InvalidArgumentException,
                        AccessDeniedException

Deletes the specified sheets.

Parameters:
range - A range object specifying the sheets to be deleted.
Throws:
SelectionException - If range contains all visible sheets in the workbook.
InvalidArgumentException - if the specified sheets are not in this book.
AccessDeniedException - if the operation is not allowed due to workbook protection.
Specified by:
deleteSheet in interface Book
Since:
12.0
See Also:
insertSheet(BookView), deleteSheet(BookView), BookModel.deleteSheet(Range)

moveSheet

public void moveSheet(int insertAt,
                      Range rangeAPI)
               throws InvalidArgumentException
Moves the specified sheets to a specified location.
Parameters:
nInsertAt - The location to which to move the sheets.
range - A range object specifying the sheets to be moved.
Throws:
InvalidArgumentException - if insertAt is not a valid sheet index.
Specified by:
moveSheet in interface Book
Since:
12.0
See Also:
moveSheet(int, BookView), copySheet(int, Range), BookModel.moveSheet(int, Range)

moveSheet

public void moveSheet(int insertAt,
                      BookView bookView)
               throws InvalidArgumentException
Moves all sheets selected in the specified view, to a specified location.
Parameters:
insertAt - The location to which to move the sheets.
bookView - The view whose selection is to be moved.
Throws:
InvalidArgumentException - if insertAt is not a valid sheet index.
Specified by:
moveSheet in interface Book
Since:
12.0
See Also:
moveSheet(int, Range), copySheet(int, BookView), BookModel.moveSheet(int)

findBook

public Book findBook(java.lang.String bookName)
Attempts to find a workbook with the specified name in the same group as this workbook.
Parameters:
bookName - the name of the workbook to find.
Returns:
a Book object. Returns null if the specified Book object is not found.
Specified by:
findBook in interface Book

forceRecalc

public void forceRecalc()
Marks all formulas in the workbook as needing to be recalculated.

Normally, e.Spreadsheet uses a complex algorithm that avoids calculating cells as much as possible. This method allows the developer to selectively circumvent e.Spreadsheet's normal algorithm and causes all cells in the workbook containing a formula to recalculate every time the workbook is recalculated.

Specified by:
forceRecalc in interface Book
See Also:
checkRecalc(), isAutoRecalc(), recalc(), setAutoRecalc(boolean)

gc

public void gc(boolean collectFormats,
               boolean collectFormulas)
Performs garbage collection on formatting and/or formula information associated with a workbook.

Workbooks have resources associated with them that are not garbage collected after every change to a workbook. These resources are broken up into formatting information and formula information.

As a general rule, resources associated with formatting are garbage collected only when a workbook is saved, whereas formula information is normally garbage collected by a background thread after recalculation is complete, as well as when a workbook is saved. This normal operation has proven to be more than adequate for normal interactive use.

In some circumstances it might be necessary to call this method from time to time to prevent e.Spreadsheet from keeping too much of this stale information around.

If you are using com.f1j.ss.Book directly (as you might in a server environment), there is no background thread cleaning up the formula information. If your application is making many dynamic changes of a non-repetitive nature to formulas or defined names, you will probably need to call Book.gc(false, true) from time to time to keep Formula One from leaking memory. Note that, because all workbooks within a group share one set of formula information, this operation garbage collects formula information for all workbooks in a group.

If your application never writes out a workbook to a workbook format (Excel or e.Spreadsheet), and is making many non-repetitive, dynamic changes to workbook formatting (cell formats, fonts, validation rules), you will probably need to call Book.gc(true, false) from time to time to keep e.Spreadsheet from leaking memory.

Saved workbook files never contain stale formatting or formula information.

Initializing a workbook or reading a new workbook into a workbook always forces garbage collection to occur.

Parameters:
collectFormats - boolean. true to do garbage collection on the formatting information.
collectFormulas - boolean. true to do garbage collection on the formula information for all workbooks in the same group as the specified workbook.
Specified by:
gc in interface Book

getCellFormat

public CellFormat getCellFormat(int sheet1,
                                int row1,
                                int col1,
                                int sheet2,
                                int row2,
                                int col2)
                         throws F1Exception
Returns the format of the specified range of cells in the specified range of sheets.
Parameters:
sheet1 - the beginning sheet.
row1 - the first row in the range.
col1 - the first column in the range.
sheet2 - the ending sheet.
row2 - the ending row in the range.
col2 - the ending column in the range. Rows are indexed from top to bottom beginning with 0. Sheets and columns are indexed from left to right beginning with 0.
Returns:
a CellFormat object.
Throws:
F1Exception - when an exception occurs
Specified by:
getCellFormat in interface Book

getColWidthUnits

public short getColWidthUnits()
Returns whether column widths are stored and displayed in twips or in character units.
Returns:
the type of units used for column widths:
                                  eColWidthUnitsNormal = 0
                                  eColWidthUnitsTwips  = 1
Specified by:
getColWidthUnits in interface Book
See Also:
BookModel.setColWidthUnits(short)

getDefaultDataSet

public DataSet getDefaultDataSet()
Returns the default DataSet for this book. Returns null if there are no queries defined in this book.
Returns:
the default DataSet for this book.
Specified by:
getDefaultDataSet in interface Book
Since:
12.0
See Also:
setDefaultDataSet(com.f1j.data.DataSet), DataSet

setDefaultDataSet

public void setDefaultDataSet(DataSet dataSet)
                       throws InvalidArgumentException
Sets the default DataSet for this book. Throws InvalidArgumentException if the specified DataSet is not defined within the book. Setting the default DataSet to null will result in the default being reset to the first available DataSet, if one exists.
Parameters:
dataSet - The DataSet that should be used as the default for this book.
Throws:
InvalidArgumentException - if the specified DataSet does not exist in the book.
Specified by:
setDefaultDataSet in interface Book
Since:
12.0
See Also:
getDefaultDataSet(), DataSet

getDefinedName

public java.lang.String getDefinedName(java.lang.String name,
                                       int row,
                                       int col)
                                throws F1Exception
Returns the definition associated with a defined name given the offset provided by the row and column parameters.

A defined name can refer to a cell, a group of cells, a value, or a formula.

Parameters:
name - the defined name.
row - a relative defined name definition will be adjusted so it is relative to this row.
col - a relative defined name definition will be adjusted so it is relative to this column.
Returns:
a string containing the name's definition.
Throws:
F1Exception - if the specified name does not exist
Specified by:
getDefinedName in interface Book
See Also:
deleteDefinedName(java.lang.String), setDefinedName(java.lang.String, java.lang.String, int, int, boolean, boolean, short)

getPivotGroup

public PivotGroup getPivotGroup()
Returns a reference to the PivotRange group.
Returns:
the PivotRange group for this workbook.
Specified by:
getPivotGroup in interface Book
Since:
11.0

getReportFunctionsGroup

public ReportFunctionsGroup getReportFunctionsGroup()
Returns a reference to the ReportFunctionsGroup.
Returns:
the ReportFunctionsGroup for this workbook.
Specified by:
getReportFunctionsGroup in interface Book
Since:
12.0

getGroupName

public java.lang.String getGroupName()
Returns the Group name for this Book.
Returns:
a text string indicating the Group name.
Specified by:
getGroupName in interface Book
See Also:
setGroupName(java.lang.String)

getIterationMax

public int getIterationMax()
Returns the maximum number of calculation iterations.

Iteration can be used to resolve circular references. e.Spreadsheet calculates until it has iterated the number of times specified by the maximum number of iterations set in the setIterationMax method or until all cells change by less than the amount specified as the maximum iteration change value in the setIterationMaxChange method. Iteration is enabled by calling the setIterationEnabled method.

Returns:
an integer indicating the maximum number of iterations.
Specified by:
getIterationMax in interface Book
See Also:
setIterationEnabled(boolean), setIterationMax(int)

getIterationMaxChange

public double getIterationMaxChange()
Returns the maximum iteration change value.

Iteration can be used to resolve circular references. e.Spreadsheet calculates until it has iterated the number of times specified by the maximum number of iterations set in the setIterationMax method or until all cells change by less than the amount specified as the maximum iteration change value in the setIterationMaxChange method. Iteration is enabled by calling the setIterationEnabled method.

Returns:
an integer indicating the maximum iteration change value.
Specified by:
getIterationMaxChange in interface Book
See Also:
setIterationMaxChange(double)

getModifiedCount

public long getModifiedCount()
Returns the modified count of this workbook.

The modified count of a workbook is incremented every time a change is made. This is useful for determining if a workbook has changed since the last time the getModifiedCount() method was called.

Returns:
a long indicating the number of modified events.
Specified by:
getModifiedCount in interface Book
See Also:
getModifiedCount(), ModifiedEvent, ModifiedListener, ReadResults.isModified()

getName

public java.lang.String getName()
Returns the name assigned to this workbook.
Returns:
string text of the name.
Specified by:
getName in interface Book
See Also:
setName(java.lang.String), getCodeName()

getCodeName

public java.lang.String getCodeName()
Returns the VBA object name assigned to this workbook.
Returns:
VBA object name
Specified by:
getCodeName in interface Book
Since:
11.0.1
See Also:
setCodeName(java.lang.String), getName()

getReadResults

public ReadResults getReadResults()
Deprecated. Replaced by Document.getDocumentSaveOptions(), Document.getDocumentType()
Returns a ReadResults object representing the last known settings for a file associated with this workbook. The ReadResults object returned contains the file properties associated with the most recent read and/or write operations performed on this workbook.

If no read or write operation has ever been performed on this workbook, a valid object with default settings is returned.

Returns:
a ReadResults object
Specified by:
getReadResults in interface Book
See Also:
read(byte[]), write(com.f1j.ss.Sheet, short), ReadResults

getSheet

public Sheet getSheet(int sheet)
Returns the Sheet at the specified index.
Parameters:
sheet - the index number of the sheet to return; 0-based.
Returns:
a Sheet object
Specified by:
getSheet in interface Book
See Also:
getSheetCount(), BookModel.setSheet(int)

getSheetCount

public int getSheetCount()
Returns the number of worksheets in this workbook.
Returns:
an integer indicating the number of worksheets.
Specified by:
getSheetCount in interface Book
See Also:
setNumSheets(int)

getVersion

public int getVersion()
Returns the version of the component.
Returns:
an integer indicating the version number.
Specified by:
getVersion in interface Book
See Also:
getVersionString()

getVersionString

public java.lang.String getVersionString()
Returns the version of the component in a string.
Returns:
a string describing the version.
Specified by:
getVersionString in interface Book
See Also:
getVersion()

hasPivotGroup

public boolean hasPivotGroup()

Returns true if the book has a PivotRange group.

In applications where the presence of PivotRange group without actual PivotRanges is considered undesirable because of memory footprint or file size concerns, this method should be called to see if a group already exist in the book. This way the application can avoid a call to the getPivotGroup method, which would automatically create a PivotRange group.

Returns:
true/false
Specified by:
hasPivotGroup in interface Book
Since:
11.0
See Also:
getPivotGroup()

hasReportFunctionsGroup

public boolean hasReportFunctionsGroup()

Returns true if the book has a ReportFunctionsGroup.

In applications where the presence of ReportFunctionsGroup without actual Report Functions is considered undesirable because of memory footprint or file size concerns, this method should be called to see if a group already exist in the book. This way the application can avoid a call to the getReportFunctionsGroup method, which would automatically create a ReportFunctionsGroup. \ *

Returns:
true/false
Specified by:
hasReportFunctionsGroup in interface Book
Since:
12.0
See Also:
getReportFunctionsGroup()

initBook

public void initBook()
Initilaizes a workbook to a default, empty state.
Specified by:
initBook in interface Book
See Also:
write(com.f1j.ss.Sheet, short)

isAutoRecalc

public boolean isAutoRecalc()
Returns whether or not automatic recalc is on.
Returns:
boolean. true = automatic recalc is on.
Specified by:
isAutoRecalc in interface Book
See Also:
forceRecalc(), checkRecalc(), recalc(), setAutoRecalc(boolean)

isIterationEnabled

public boolean isIterationEnabled()
Returns true if iteration is enabled.

Iteration can be used to resolve circular references. e.Spreadsheet calculates until it has iterated the number of times specified by the maximum number of iterations set in the setIterationMax method or until all cells change by less than the amount specified as the maximum iteration change value in the setIterationMaxChange method. Iteration is enabled by calling the setIterationEnabled method.

Returns:
boolean. true = iteration is enabled.
Specified by:
isIterationEnabled in interface Book
See Also:
setIterationEnabled(boolean)

isPrecisionAsDisplayed

public boolean isPrecisionAsDisplayed()
Returns true if all cell values are rounded to the displayed precision.

If true, the value in each cell is rounded to the precision displayed in the cell. If false, the value in each cell is stored as entered or calculated.

Returns:
boolean. true = cell values are rounded.
Specified by:
isPrecisionAsDisplayed in interface Book
See Also:
setPrecisionAsDisplayed(boolean)

read

public short read(byte[] blob)
           throws F1Exception
Deprecated. Replaced by Document.Document(com.f1j.util.Group, byte[], DocumentOpenCallback)
Reads a workbook that has been stored in memory in a byte array.
Parameters:
blob - a reference to a byte array.
Returns:
the type of the file read from the byte array.
Throws:
F1Exception - if an error occurs reading the file.
Specified by:
read in interface Book
See Also:
read(byte[]), write(com.f1j.ss.Sheet, short), writeToBlob()

read

public ReadResults read(byte[] blob,
                        com.f1j.ss.ReadParams rp)
                 throws F1Exception
Deprecated. Replaced by Document.Document(com.f1j.util.Group, byte[], DocumentOpenCallback)
Reads a workbook that has been stored in memory in a byte array.
Parameters:
blob - reference to a byte array.
rp - parameters for this read operation.
Returns:
a ReadResults object describing the file read.
Throws:
F1Exception - if an error occurs reading the file.
Specified by:
read in interface Book
See Also:
ReadParams, ReadResults, read(byte[]), write(com.f1j.ss.Sheet, short), writeToBlob()

read

public short read(java.io.InputStream inputStream)
           throws java.io.IOException,
                  F1Exception
Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.InputStream, DocumentOpenCallback)
Reads a worksheet or workbook from the specified input stream.
Parameters:
inputStream - the input stream to read from.
Returns:
a short indicating the type of file read from the stream.
Throws:
F1Exception - if a parameter is invalid
java.io.IOException if an IO error occurs
Specified by:
read in interface Book
See Also:
readFromBlob(byte[]), write(com.f1j.ss.Sheet, short)

read

public short read(java.io.InputStream inputStream,
                  short eCodePage)
           throws java.io.IOException,
                  F1Exception
Deprecated. Replaced by