com.f1j.ss
Interface Book

All Known Implementing Classes:
BookImpl

public interface Book
extends Model, Constants, com.f1j.util.ParseConstants

This interface describes the public API for the low level model of an e.Spreadsheet workbook. An implementation of Book contains an array of sheets, as well as information which applies to the entire workbook.

See Also:
BookImpl

Fields inherited from class com.f1j.ss.Constants
eClearAll, eClearContents, eClearDlg, eClearFormats, eClearValues, eColWidthUnitsNormal, eColWidthUnitsTwips, eCopyAll, eCopyFormats, eCopyFormulas, eCopyValues, eEncryptionAuto, eEncryptionExcel97, eEncryptionWeak, eFileActuate9, eFileCurrentFormat, eFileESpreadsheet11, eFileExcel5, eFileExcel97, eFileExcel97And5, eFileFormulaOne3, eFileFormulaOne6, eFileFormulaOne7, eFileTabbedText, eFileTabbedTextValuesOnly, eFileUnicodeText, eFileUnicodeTextValuesOnly, eFixupAppend, eFixupIgnoreAdjacentRanges, eFixupPrepend, eOutlineCollapsed, eOutlineExpanded, eOutlineTerminal, eParamCurrency, eParamDate, eParamDouble, eParametersFileActuate5, eParametersFileActuate6, eParametersFileActuate7, eParametersFileActuate8, eParamFormula, eParamInteger, eParamString, eQueryParamCurrency, eQueryParamDate, eQueryParamDouble, eQueryParamFormula, eQueryParamInteger, eQueryParamString, eSheetHidden, eSheetShown, eSheetTypeChart, eSheetTypeSheet, eSheetVeryHidden, eShiftColumns, eShiftHorizontal, eShiftRows, eShiftVertical, eShowAutomatic, eShowOff, eShowOn, eTabsBottom, eTabsOff, eTabsTop, eTypeEmpty, eTypeError, eTypeLogical, eTypeNumber, eTypeText, kAllowDefault, kAllowDeleteColumns, kAllowDeleteRows, kAllowEditObjects, kAllowFormatCells, kAllowFormatColumns, kAllowFormatRows, kAllowInsertColumns, kAllowInsertHyperlinks, kAllowInsertRows, kAllowNone, kAllowSelectLocked, kAllowSelectUnlocked, kAllowSort, kAllowUseAutoFilter, kAllowUsePivotRanges, kCodePageDefaultANSI, kCodePageUnicodeBE, kCodePageUnicodeLE, kCodePageUTF8, kContentsChanged, kFontChanged, kFormatChanged, kMaxCellText, kMaxCol, kMaxCols, kMaxPaletteEntry, kMaxRow, kMaxRows, kMaxSheet, kMaxSheets, kProtectStructure
 
Fields inherited from class com.f1j.mvc.Constants
kPaper10x14, kPaper11x17, kPaperA3, kPaperA4, kPaperA4Small, kPaperA5, kPaperB4, kPaperB5, kPaperCSheet, kPaperDSheet, kPaperEnv10, kPaperEnv11, kPaperEnv12, kPaperEnv14, kPaperEnv9, kPaperEnvB4, kPaperEnvB5, kPaperEnvB6, kPaperEnvC3, kPaperEnvC4, kPaperEnvC5, kPaperEnvC6, kPaperEnvC65, kPaperEnvDL, kPaperEnvItaly, kPaperEnvMonarch, kPaperEnvPersonal, kPaperESheet, kPaperExecutive, kPaperFanfoldLglGerman, kPaperFanfoldStdGerman, kPaperFanfoldUS, kPaperFolio, kPaperLedger, kPaperLegal, kPaperLetter, kPaperLetterSmall, kPaperNote, kPaperQuarto, kPaperStatement, kPaperTabloid
 
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 nInsertAt, Range range)
          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 range)
          Deletes the specified sheets.
 void deleteSheets(int sheet, int sheets)
          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 absRow, boolean absCol)
          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 sheet, int sheets)
          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 nInsertAt, Range range)
          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 codePage)
          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 codePage)
          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)
 
Methods inherited from interface com.f1j.mvc.Model
getGroup, getLock, hasLock, releaseLock, rewindLock, unwindLock
 

Method Detail

checkRecalc

public void checkRecalc()
Recalculates the workbook, if needed.
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

createDatabase

public DataBase createDatabase()
Creates a new Database object.
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
See Also:
getDefinedName(java.lang.String, int, int), setDefinedName(java.lang.String, java.lang.String, int, int)

deleteSheets

public void deleteSheets(int sheet,
                         int sheets)
                  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
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.
Since:
12.0
See Also:
insertSheet(BookView), deleteSheet(Range), BookModel.deleteSheet()

deleteSheet

public void deleteSheet(Range range)
                 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.
Since:
12.0
See Also:
insertSheet(BookView), deleteSheet(BookView), BookModel.deleteSheet(Range)

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.

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.

See Also:
checkRecalc(), isAutoRecalc(), recalc(), setAutoRecalc(boolean)

formatRCNr

public java.lang.String formatRCNr(int row,
                                   int col,
                                   boolean absRow,
                                   boolean absCol)
Formats a row and column number as text.
Parameters:
row - the row to format.
col - the column to format.
absRow - boolean. true = the row should be formatted as absolute.
absCol - boolean. true = the column should be formatted as absolute.
Returns:
the formatted row and column number as a String.

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.

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

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
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.
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.
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
See Also:
deleteDefinedName(java.lang.String), setDefinedName(java.lang.String, java.lang.String, int, int)

getDefinedNameCount

public int getDefinedNameCount()
Returns the number of defined names in a view.
Returns:
the number of defined names.
See Also:
setDefinedName(java.lang.String, java.lang.String, int, int)

getDocument

public Document getDocument()
Returns the Document object associated with this book.
Since:
12.0

getPivotGroup

public PivotGroup getPivotGroup()
Returns a reference to the PivotRange group.
Returns:
the PivotRange group for this workbook.
Since:
11.0

getReportFunctionsGroup

public ReportFunctionsGroup getReportFunctionsGroup()
Returns a reference to the ReportFunctionsGroup.
Returns:
the ReportFunctionsGroup for this workbook.
Since:
12.0

getGroupName

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

getHyperlinkBase

public java.lang.String getHyperlinkBase()
Returns the hyperlink base string used for relative hyperlinks. Book.
Returns:
a text string indicating hyperlink base null means no base string
See Also:
setHyperlinkBase(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.
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.
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.
See Also:
BookImpl.getModifiedCount(), ModifiedEvent, ModifiedListener, ReadResults.isModified()

getName

public java.lang.String getName()
Returns the name assigned to this workbook.
Returns:
string text of the name.
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
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
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
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.
See Also:
setNumSheets(int)

getVersion

public int getVersion()
Returns the version of the component.
Returns:
an integer indicating the version number.
See Also:
getVersionString()

getVersionString

public java.lang.String getVersionString()
Returns the version of the component in a string.
Returns:
a string describing the version.
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
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
Since:
12.0
See Also:
getReportFunctionsGroup()

initBook

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

insertSheets

public void insertSheets(int sheet,
                         int sheets)
                  throws F1Exception
Inserts one or more worksheets at the specified location.
Parameters:
sheet - identifies the index number of the worksheet in front of which you want to insert the new sheet or sheets. Sheets are indexed from left to right beginning with 0. Do not confuse the sheet index number with the sheet name that appears on the sheet tab.
sheets - determines how many sheets are inserted.
Throws:
F1Exception - when an exception occurs
See Also:
deleteSheets(int, int)

insertSheet

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

Inserts one or more sheets before the active sheet of the specified view.

The number of sheets inserted is the same as the number of sheets selected. However, if the selected sheets are not contiguous, an exception is thrown.

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

isAutoRecalc

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

isColWidthInTwips

public boolean isColWidthInTwips()
Returns whether column widths are stored in twips for this workbook.
Returns:
boolean. true = column widths stored in twips.

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.
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.
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.
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.
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
See Also:
readFromBlob(byte[]), write(com.f1j.ss.Sheet, short)

read

public ReadResults read(java.io.InputStream inputStream,
                        com.f1j.ss.ReadParams rp)
                 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.
rp - parameters for this read operation.
Returns:
a ReadResults object describing the file read.
Throws:
F1Exception - if a parameter is invalid
java.io.IOException if an IO error occurs
See Also:
ReadParams, ReadResults, readFromBlob(byte[]), write(com.f1j.ss.Sheet, short)

read

public short read(java.io.InputStream inputStream,
                  short codePage)
           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.
codePage - the default code page.
Returns:
the type of file read from the stream.
Throws:
F1Exception - if a parameter is invalid
java.io.IOException if an IO error occurs
See Also:
readFromBlob(byte[]), write(com.f1j.ss.Sheet, short)

read

public short read(java.lang.String fileName)
           throws java.io.IOException,
                  F1Exception
Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.File, boolean, DocumentOpenCallback)
Reads a workbook from disk.

Parameters:
fileName - the path and filename of the workbook.
Returns:
the type of file read:
         eFileExcel5
         eFileExcel97
         eFileExcel97And5
         eFileFormulaOne3
         eFileFormulaOne6
         eFileFormulaOne7
         eFileESpreadsheet11
         eFileTabbedText
Throws:
java.io.IOException if an IO error occurs
F1Exception - if an error occurs
See Also:
write(com.f1j.ss.Sheet, short)

read

public ReadResults read(java.lang.String fileName,
                        com.f1j.ss.ReadParams rp)
                 throws java.io.IOException,
                        F1Exception
Deprecated. Replaced by Document.Document(com.f1j.util.Group, java.io.File, boolean, DocumentOpenCallback)
Reads a workbook from disk.

Parameters:
fileName - the path and filename of the workbook.
rp - parameters for this read operation.
Returns:
a ReadResults object describing the file read.
Throws:
java.io.IOException if an IO error occurs
F1Exception - if an error occurs
See Also:
ReadParams, ReadResults, write(com.f1j.ss.Sheet, short)

readFromBlob

public short readFromBlob(byte[] blob)
                   throws java.io.IOException,
                          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.
Returns:
the type of the file read from the byte array.
Throws:
F1Exception - if an error occurs reading the file.
java.io.IOException if an IO error occurs
See Also:
read(byte[]), write(com.f1j.ss.Sheet, short), writeToBlob()

readFromBlob

public ReadResults readFromBlob(byte[] blob,
                                com.f1j.ss.ReadParams rp)
                         throws java.io.IOException,
                                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:
java.io.IOException if an IO error occurs
F1Exception - if an error occurs reading the file.
See Also:
ReadParams, ReadResults, read(byte[]), write(com.f1j.ss.Sheet, short), writeToBlob()

recalc

public void recalc()
            throws F1Exception
Recalculates this workbook.

Recalculates all formulas in this workbook.

Throws:
F1Exception - if an exception occurs
See Also:
forceRecalc(), checkRecalc(), isAutoRecalc(), setAutoRecalc(boolean)

setAutoRecalc

public void setAutoRecalc(boolean autoRecalc)
Sets the flag that determines whether or not automatic recalc is on.
Parameters:
autoRecalc - boolean. true = the workbook recalculates automatically, as needed.
See Also:
forceRecalc(), checkRecalc(), isAutoRecalc(), recalc()

setDefinedName

public void setDefinedName(java.lang.String name,
                           java.lang.String formula,
                           int row,
                           int col)
                    throws F1Exception
Sets the formula associated with a defined name, in US English.
Parameters:
name - A defined name. Enter an existing name if you are returning the formula associated with the name or changing the value associated with the name. Enter a unique name if you are creating a new value.
formula - Describes the range represented by name. A name can refer to a cell, a group of cells, a value, or a formula. When setting name, do not include a leading equal sign (=) in the formula.
row - relative row references will be relative to this row.
col - relative column references will be relative to this column.
Throws:
F1Exception - if an exception occurs
See Also:
getDefinedName(java.lang.String, int, int)

setDefinedName

public void setDefinedName(java.lang.String name,
                           java.lang.String formula,
                           int row,
                           int col,
                           boolean param,
                           boolean strip,
                           short type)
                    throws F1Exception
Sets the formula associated with a defined name, in US English.
Parameters:
name - A defined name. Enter an existing name if you are returning the formula associated with the name or changing the value associated with the name. Enter a unique name if you are creating a new value.
formula - Describes the range represented by name. A name can refer to a cell, a group of cells, a value, or a formula. When setting name, do not include a leading equal sign (=) in the formula.
row - relative row references will be relative to this row.
col - relative column references will be relative to this column.
param - true if this is a report parameter.
strip - true to remove this parameter when saving to Excel format (ignored if param is false).
type - Indicates the type of parameter (eParamString, eParamInteger, eParamDouble, eParamDate, eParamCurrency). This is ignored if param is false.
Throws:
F1Exception - if an exception occurs
See Also:
getDefinedName(java.lang.String, int, int)

setDefinedName

public void setDefinedName(java.lang.String name,
                           java.lang.String formula,
                           Sheet sheet,
                           int row,
                           int col)
                    throws F1Exception
Sets the formula associated with a defined name, in US English.
Parameters:
name - A defined name. Enter an existing name if you are returning the formula associated with the name or changing the value associated with the name. Enter a unique name if you are creating a new value.
formula - Describes the range represented by name. A name can refer to a cell, a group of cells, a value, or a formula. When setting name, do not include a leading equal sign (=) in the formula.
sheet - the sheet to use for cell references that do not specify a sheet.
row - relative row references will be relative to this row.
col - relative column references will be relative to this column.
Throws:
F1Exception - if an exception occurs
See Also:
getDefinedName(java.lang.String, int, int)

setDefinedName

public void setDefinedName(java.lang.String name,
                           java.lang.String formula,
                           Sheet sheet,
                           int row,
                           int col,
                           boolean param,
                           boolean strip,
                           short type)
                    throws F1Exception
Sets the formula associated with a defined name, in US English.
Parameters:
name - A defined name. Enter an existing name if you are returning the formula associated with the name or changing the value associated with the name. Enter a unique name if you are creating a new value.
formula - Describes the range represented by name. A name can refer to a cell, a group of cells, a value, or a formula. When setting name, do not include a leading equal sign (=) in the formula.
sheet - the sheet to use for cell references that do not specify a sheet.
row - relative row references will be relative to this row.
col - relative column references will be relative to this column.
param - true if this is a report parameter.
strip - true to remove this parameter when saving to Excel format (ignored if param is false).
type - the type of Parameter (eParamString, eParamInteger, eParamDouble, eParamDate, or eParamCurrency) this is ignored if param is false.
Throws:
F1Exception - if an exception occurs
See Also:
getDefinedName(java.lang.String, int, int)

setGroupName

public void setGroupName(java.lang.String group)
                  throws F1Exception
Sets the group name for this workbook.

Reasons to put multiple workbooks in the same group are:

Disadvantages of putting multiple workbooks in the same group are:

Parameters:
group - the new group name for this workbook. A value of null or "" will put the workbook in it's own group.
Throws:
F1Exception - if the group cannot be set due to lack of resources.
See Also:
getGroupName(), JBook.destroy()

setHyperlinkBase

public void setHyperlinkBase(java.lang.String s)
Sets the hyperlink base string - use null to turn off Book.
See Also:
getHyperlinkBase()

setIterationEnabled

public void setIterationEnabled(boolean iterationEnabled)
Sets whether 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.

Parameters:
iterationEnabled - boolean. true = iteration is enabled.
See Also:
isIterationEnabled(), setIterationMax(int), setIterationMaxChange(double)

setIterationMax

public void setIterationMax(int iterationMax)
Sets the maximum number of 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.

Parameters:
iterationMax - Maximum number of iterations.
See Also:
getIterationMax(), setIterationEnabled(boolean), setIterationMaxChange(double)

setIterationMaxChange

public void setIterationMaxChange(double iterationMaxChange)
Sets 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.

Parameters:
iterationMaxChange - The maximum change value for iterations.
See Also:
getIterationMaxChange(), setIterationMaxChange(double)

setNumSheets

public void setNumSheets(int sheets)
                  throws F1Exception
Sets the number of worksheets in this workbook.

Use this method to change the number of worksheets in the workbook. Worksheets are added to or deleted from the end of the current list of worksheets. To add worksheets between existing worksheets, use the insertSheets method. To delete worksheets, use the deleteSheets method.

Parameters:
sheets - the number of worksheets that make up the workbook.
Throws:
F1Exception - if an exception occurs.
See Also:
getSheetCount(), insertSheets(int, int), deleteSheets(int, int)

setPrecisionAsDisplayed

public void setPrecisionAsDisplayed(boolean precisionAsDisplayed)
Determines whether cell values are stored as entered or as displayed.
Parameters:
precisionAsDisplayed - boolean. If true, the value in each cell is rounded to the precision displayed in the cell. If false, the value is stored as entered or calculated.
See Also:
isPrecisionAsDisplayed()

setName

public void setName(java.lang.String name)
Sets the name assigned to this workbook.

A number of methods reference a workbook by its name instead of its handle. This is also the name used to refer to the workbook in external references. For example, if you set the workbook name to MySheet, you can refer to Sheet1!A1 in that workbook by entering the formula [MySheet]Sheet1!A1 in another workbook.

Parameters:
name - the new workbook name.
See Also:
getName(), setCodeName(java.lang.String)

setCodeName

public void setCodeName(java.lang.String codeName)
                 throws F1Exception
Assigns a VBA object name to this workbook. This is the name for the workbook that appears in a VBA project in Microsoft Excel. It is usually not the same as the workbook's filename.
Parameters:
codeName - the new VBA object name of the workbook.
Throws:
F1Exception - if the name is invalid, or if it is a duplicate name.
Since:
11.0.1
See Also:
getCodeName(), setName(java.lang.String)

write

public byte[] write(Sheet sheet,
                    short eFileType)
             throws F1Exception
Deprecated. Replaced by Document.fileSaveCopyAsByteArray(DocumentType, DocumentSaveCallback)
Writes the workbook to a blob. Before calling this method, the programmer must first call one of the read methods to load a spreadsheet into the book or call the Book.initBook method.
Parameters:
sheet - the sheet to write if the file type is eFileTabbedText or eFileTabbedTextValuesOnly. This value is ignored for other file types and may be null.
eFileType - Constant that describes how the data in the workbook is saved.
                                       eFileTabbedText
                                       eFileFormulaOne3
                                       eFileFormulaOne6
                                       eFileFormulaOne7
                                       eFileESpreadsheet11
                                       eFileExcel5
                                       eFileExcel97
                                       eFileExcel97And5
                                       eFileTabbedTextValuesOnly
                                       eFileCurrentFormat
Returns:
a byte array containing the workbook in the specified file format.
Throws:
F1Exception - if an error occurs
See Also:
read(byte[]), write(com.f1j.ss.Sheet, short), readFromBlob(byte[])

write

public byte[] write(Sheet sheet,
                    com.f1j.ss.WriteParams wp)
             throws F1Exception
Deprecated. Replaced by Document.fileSaveCopyAsByteArray(DocumentType, DocumentSaveCallback)
Writes the workbook to a blob. Before calling this method, the programmer must first call one of the read methods to load a spreadsheet into the book or call the Book.initBook method.
Parameters:
sheet - the sheet to write if the file type is one of the tabbed text or Unicode text types. This value is ignored for other file types and may be null.
wp - parameters for this write operation.
Returns:
a byte array containing the workbook in the format specified in the wp parameter.
Throws:
F1Exception - if an error occurs
See Also:
WriteParams, read(byte[]), write(com.f1j.ss.Sheet, short), readFromBlob(byte[])

write

public boolean write(Sheet sheet,
                     java.io.OutputStream stream,
                     short eFileType)
              throws java.io.IOException,
                     F1Exception
Deprecated. Replaced by Document.fileSaveCopyAs(java.io.OutputStream, DocumentType, DocumentSaveCallback)
Saves the workbook to the specified output stream. Before calling this method, the programmer must first call one of the read methods to load a spreadsheet into the book or call the Book.initBook method.
Parameters:
sheet - the sheet to write if the file type is eFileTabbedText or eFileTabbedTextValuesOnly. This value is ignored for other file types and may be null.
stream - java.io.Outputstream that describes where to save the file.
eFileType - Constant that describes how the data in the workbook is saved.
                                                        eFileTabbedText
                                                        eFileFormulaOne3
                                                        eFileFormulaOne6
                                                        eFileFormulaOne7
                                                        eFileESpreadsheet11
                                                        eFileExcel5
                                                        eFileExcel97
                                                        eFileExcel97And5
                                                        eFileTabbedTextValuesOnly
                                                        eFileCurrentFormat
Throws:
java.io.IOException if an IO error occurs
F1Exception - if an error occurs
See Also: