com.extentech.ExtenXLS
Class WorkBookParser

java.lang.Object
  extended by com.extentech.ExtenXLS.DocumentHandle
      extended by com.extentech.ExtenXLS.WorkBookHandle
          extended by com.extentech.ExtenXLS.WorkBookParser
All Implemented Interfaces:
Document, Handle, WorkBook, java.io.Closeable

public class WorkBookParser
extends WorkBookHandle

A READ-ONLY WorkBookHandle implementation which handles high-performance spreadsheet reading using a parse-event driven model. The constructor to this class takes a ParseEventListener which is registered as a listener on the parsing of the spreadsheet cells. Parse Event listeners are fired while parsing cells in a workbook. example:

 

// create a new custom cell value class
class testCellParseEventListener implements CellParseEventListener{
        // override the fire method
        // @see com.extentech.ExtenXLS.CellParseEventListener#fireEvent(com.extentech.ExtenXLS.Cell)
        public void fireEvent(Cell v) {
                // Logger.logInfo("Got Cell: " + v.toString());
                Object val = v.getVal();
                String formattedVal = v.getFormattedStringVal();
                String celladdress = v.getCellAddress();
                String sheetname = v.getWorkSheetName();
                int rownum = v.getRowNum();
                int colnum = v.getColNum();
                int formatid = v.getFormatId();
        }
}

// create new parse event listener
testCellParseEventListener tcv = new testCellParseEventListener();

WorkBookParser wbpp = null;
if (encrypted) {
   wbpp = (WorkBookParser) MSOfficeDecrypter.decryptPP(is, password, tcv);
} else {
wbpp = new WorkBookParser(is,tcv);
}
The parser handles reading XLS, XLSX, and encrypted input of either variety. You will need to implement code in the "CellParseEventListener" to register event handling for parse events which occur as the parser encounters spreadsheet values in the file stream.

Author:
John McMahon :: Apr 1, 2011 :: Copyright ©2011 Extentech Inc.
See Also:
Cell, CellParseEventListener, SimpleCellValue, WorkBookParser

Field Summary
 
Fields inherited from class com.extentech.ExtenXLS.WorkBookHandle
CONVERTMULBLANKS, FORMAT_XLS, FORMAT_XLSM, FORMAT_XLSX, FORMAT_XLTM, FORMAT_XLTX, simpledateformat
 
Fields inherited from class com.extentech.ExtenXLS.DocumentHandle
FORMAT_NATIVE
 
Fields inherited from interface com.extentech.ExtenXLS.WorkBook
ALLOWDUPES, CALC_MODE_PROP, CALCULATE_ALWAYS, CALCULATE_AUTO, CALCULATE_EXPLICIT, REFTRACK_PROP, SHAREDUPES, STRING_ENCODING_AUTO, STRING_ENCODING_COMPRESSED, STRING_ENCODING_UNICODE, USETEMPFILE_PROP
 
Fields inherited from interface com.extentech.ExtenXLS.Document
DEBUG_HIGH, DEBUG_LOW, DEBUG_MEDIUM
 
Constructor Summary
WorkBookParser()
          override default constructor which initializes default workbook
WorkBookParser(java.io.InputStream inx, CellParseEventListener tcv)
          this constructor takes an inputstream and your custom CellParseEventListener
 
Method Summary
 void addListener(CellParseEventListener listener)
           
 void addProperty(java.lang.String name, java.lang.Object val)
          Sets the value of a property in the workbook property store.
 boolean addSheetFromWorkBook(WorkBookHandle sourceBook, java.lang.String sourceSheetName, java.lang.String destSheetName)
          Deprecated.  
 boolean addSheetFromWorkBookWithFormatting(WorkBookHandle sourceBook, java.lang.String sourceSheetName, java.lang.String destSheetName)
          Deprecated.  
 WorkSheetHandle addWorkSheet(WorkSheetHandle sourceSheet)
          Inserts a WorkSheetHandle from a separate WorkBookhandle into the current WorkBookHandle.
 WorkSheetHandle addWorkSheet(WorkSheetHandle sourceSheet, java.lang.String NewSheetName)
          Inserts a WorkSheetHandle from a separate WorkBookhandle into the current WorkBookHandle.
 void calculateFormulas()
          Forces immediate recalculation of every formula in the workbook.
 void close()
          Closes the WorkBook and releases resources.
 void copyChartToSheet(ChartHandle chart, WorkSheetHandle sheet)
          Copies an existing Chart to another WorkSheet
 void copyChartToSheet(java.lang.String chartname, java.lang.String sheetname)
          Copies an existing Chart to another WorkSheet
 WorkSheetHandle copyWorkSheet(java.lang.String SourceSheetName, java.lang.String NewSheetName)
          Copy (duplicate) a worksheet in the workbook and add it to the end of the workbook with a new name
 ChartHandle createChart(java.lang.String name, WorkSheetHandle wsh)
          Creates a new Chart and places it at the end of the workbook
 NameHandle createNamedRange(java.lang.String name, java.lang.String rangeDef)
          Create a named range in the workbook Note that the named range designation can conform to excel specs, that is, boolean values, references, or string variables can be set.
 void deleteChart(java.lang.String chartname, WorkSheetHandle wsh)
          delete an existing chart of the workbook
 void fireParserEvent()
          notify the registered listeners of a parse event
 java.lang.String[] getAllStrings()
          Returns all strings that are in the SharedStringTable for this workbook.
 byte[] getBytes()
          Deprecated.  
 CellHandle getCell(java.lang.String address)
          Returns the Cell at the specified Location
 CellRange[] getCellRanges()
          Returns an Array of the CellRanges existing in this WorkBook specifically the Ranges referenced in Formulas, Charts, and Named Ranges.
 CellHandle[] getCells()
          Returns an array containing all cells in the WorkBook
 ChartHandle getChart(java.lang.String chartname)
          Returns a Chart Handle
 ChartHandle getChartById(int id)
          retrieve a ChartHandle via id
 ChartHandle[] getCharts()
          Returns all Chart Handles contained in the WorkBook
 FormatHandle[] getConditionalFormats()
          Returns an array of all Conditional Formats in the workbook these are formats referenced and used by the conditionally formatted ranges in the workbook.
 com.extentech.formats.XLS.WorkBookFactory getFactory()
          Gets the internal Factory object.
 FormatHandle[] getFormats()
          Returns an array of all FormatHandles in the workbook
 FormulaHandle getFormulaHandle(java.lang.String celladdress)
          Returns a Formula Handle
 ImageHandle getImage(java.lang.String imagename)
          Returns an ImageHandle for manipulating images in the WorkBook
 java.io.File getImage(java.lang.String fname, int thumbWidth, int thumbHeight, int frameWidth, int frameHeight)
          Generate a thumbnail JPEG image of the first worksheet in the workbook Feb 8, 2011
 ImageHandle[] getImages()
          Returns all ImageHandles in the workbook
 com.extentech.formats.LEO.LEOFile getLEOFile()
          Gets the internal LEOFile object.
 java.util.List getListeners()
           
 NameHandle getNamedRange(java.lang.String rangename)
          Returns a Named Range Handle
 NameHandle getNamedRangeInScope(java.lang.String rangename)
          Returns a Named Range Handle if it exists in the specified scope.
 NameHandle[] getNamedRanges()
          Returns all Named Range Handles
 NameHandle[] getNamedRangesInScope()
          Returns all Named Range Handles scoped to WorkBook.
 WorkBookHandle getNoSheetWorkBook()
          Returns a WorkBookHandle containing an empty version of this WorkBook.
 int getNumCells()
          Returns the number of Cells in this WorkBook
 PivotTableHandle getPivotTable(java.lang.String ptname)
          get a handle to a PivotTable in the WorkBook
 PivotTableHandle[] getPivotTables()
          get an array of handles to all PivotTables in the WorkBook
 java.util.Map getProperties()
          Retrieves a Map containing the workbook properties store.
 java.lang.Object getProperty(java.lang.String name)
          Retrieves a property in the workbook property store.
 java.lang.String getStats()
          Return useful statistics about this workbook.
 java.lang.String getStats(boolean usehtml)
          Return useful statistics about this workbook.
 Cell getVal()
           
 java.lang.String getWorkingDirectory()
           
 java.lang.String getXLSVersionString()
          Returns the lowest version of Excel compatible with the input file.
 int hashCode()
           
 boolean is1904()
          Returns whether this WorkBook is using the '1904' date system.
 void markFormulasDirty()
          Marks every formula in the workbook as needing a recalc.
 void recalc()
          Recalculates all dirty formulas in the workbook immediately.
 void reset()
          Resets the document state to what it was when it was loaded.
 int searchAndReplace(java.lang.String searchfor, java.lang.String replacewith)
          Searches all Cells in the workbook for the string occurrence and replaces with the replacement text.
 void setCurrentObject(Cell o)
          sets the currently parsed object
 void setDebugLevel(int l)
          Sets the debugging output level.
 void setDefaultColWidth(int t)
          set Default col width Note: only affects undefined Columns containing Cells
default width of the columns in 1/256 of the width of the zero character, using default font.
 void setDefaultRowHeight(int t)
          set Default row height in twips (=1/20 of a point) Note: only affects undefined Rows containing Cells
 void setDupeStringMode(int mode)
          Set Duplicate String Handling Mode.
 void setFormulaCalculationMode(int CalcMode)
          Set the calculation mode for the workbook.
 void setProperties(java.util.Map properties)
          Replaces the workbook properties with the values in a given Map.
 void setProtected(boolean b)
          set the workbook to protected mode Note: the password cannot be decrypted or changed in Excel -- protection can only be set/removed using ExtenXLS
 void setShowSheetTabs(boolean show)
          Sets whether the sheet selection tabs should be shown.
 void setStringEncodingMode(int mode)
          Set Encoding mode of new Strings added to file.
 boolean showSheetTabs()
          Returns whether the sheet selection tabs should be shown.
 void write(java.io.OutputStream out)
          Writes the document to the given stream in its native format.
 void write(java.io.OutputStream out, boolean Excel2007Format)
          Deprecated.  
 void write(java.io.OutputStream out, int format)
          Writes the document to the given stream in the requested format.
 void write(java.lang.String fname)
          Writes the document to the given path.
 void write(java.lang.String fname, boolean Excel2007Format)
          Writes the document to the given file in either XLS or XLSX.
 java.lang.StringBuffer writeBytes(java.io.OutputStream bout)
          Writes the document to the given stream in BIFF8 (XLS) format.
 void writeXLSXBytes(java.io.OutputStream bout)
          Writes the document to the given stream in the default OOXML format.
 void writeXLSXBytes(java.io.OutputStream bout, int format)
          Writes the document to the given stream in the requested OOXML format.
 
Methods inherited from class com.extentech.ExtenXLS.WorkBookHandle
createWorkSheet, createWorkSheet, getFileExtension, getFormat, getFormat, getFormulaCalculationMode, getIsExcel2007, getName, getNumWorkSheets, getWorkBook, getWorkSheet, getWorkSheet, getWorkSheets, isEventMode, removeAllWorkSheets, saveComponentAsJPEG, saveImageAsJPEG, setEventMode, setIsExcel2007
 
Methods inherited from class com.extentech.ExtenXLS.DocumentHandle
getFile, getFileName, getInstance, getVersion, setFile, setFileName, setName, setStreamingSheets, toString, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.extentech.ExtenXLS.WorkBook
setName, toString
 

Constructor Detail

WorkBookParser

public WorkBookParser()
override default constructor which initializes default workbook


WorkBookParser

public WorkBookParser(java.io.InputStream inx,
                      CellParseEventListener tcv)
this constructor takes an inputstream and your custom CellParseEventListener

Parameters:
inx - the inputstream containing your XLS file
tcv - the custom CellParseEventListener
Method Detail

getListeners

public java.util.List getListeners()
Returns:
Returns the listeners.

addListener

public void addListener(CellParseEventListener listener)
Parameters:
listeners - The listeners to set.

fireParserEvent

public void fireParserEvent()
notify the registered listeners of a parse event


addProperty

public void addProperty(java.lang.String name,
                        java.lang.Object val)
Description copied from class: DocumentHandle
Sets the value of a property in the workbook property store. This is not an Excel-compatible feature.

Specified by:
addProperty in interface Document
Specified by:
addProperty in interface WorkBook
Overrides:
addProperty in class DocumentHandle
Parameters:
name -
val -
See Also:
DocumentHandle.addProperty(java.lang.String, java.lang.Object)

addSheetFromWorkBook

public boolean addSheetFromWorkBook(WorkBookHandle sourceBook,
                                    java.lang.String sourceSheetName,
                                    java.lang.String destSheetName)
Deprecated. 

Description copied from class: WorkBookHandle
Inserts a worksheet from a Source WorkBook.

Specified by:
addSheetFromWorkBook in interface WorkBook
Overrides:
addSheetFromWorkBook in class WorkBookHandle
Parameters:
sourceBook -
sourceSheetName -
destSheetName -
Returns:
See Also:
WorkBookHandle.addSheetFromWorkBook(com.extentech.ExtenXLS.WorkBookHandle, java.lang.String, java.lang.String)

addSheetFromWorkBookWithFormatting

public boolean addSheetFromWorkBookWithFormatting(WorkBookHandle sourceBook,
                                                  java.lang.String sourceSheetName,
                                                  java.lang.String destSheetName)
Deprecated. 

Description copied from class: WorkBookHandle
Inserts a worksheet from a Source WorkBook. Brings all string data and formatting information from the source workbook. Be aware this is programmatically creating a large amount of new formatting information in the destination workbook. A higher performance option will usually be using getNoSheetWorkbook and addSheetFromWorkBook.

Overrides:
addSheetFromWorkBookWithFormatting in class WorkBookHandle
Parameters:
sourceBook -
sourceSheetName -
destSheetName -
Returns:
See Also:
WorkBookHandle.addSheetFromWorkBookWithFormatting(com.extentech.ExtenXLS.WorkBookHandle, java.lang.String, java.lang.String)

addWorkSheet

public WorkSheetHandle addWorkSheet(WorkSheetHandle sourceSheet,
                                    java.lang.String NewSheetName)
Description copied from class: WorkBookHandle
Inserts a WorkSheetHandle from a separate WorkBookhandle into the current WorkBookHandle. copies charts, images, formats from source workbook

Specified by:
addWorkSheet in interface WorkBook
Overrides:
addWorkSheet in class WorkBookHandle
Parameters:
sourceSheet -
NewSheetName -
Returns:
See Also:
WorkBookHandle.addWorkSheet(com.extentech.ExtenXLS.WorkSheetHandle, java.lang.String)

addWorkSheet

public WorkSheetHandle addWorkSheet(WorkSheetHandle sourceSheet)
Description copied from class: WorkBookHandle
Inserts a WorkSheetHandle from a separate WorkBookhandle into the current WorkBookHandle. copies charts, images, formats from source workbook Worksheet will be the same name as in the source workbook. To add a custom named worksheet use the addWorkSheet(WorkSheetHandle, String sheetname) method

Overrides:
addWorkSheet in class WorkBookHandle
Parameters:
sourceSheet -
Returns:
See Also:
WorkBookHandle.addWorkSheet(com.extentech.ExtenXLS.WorkSheetHandle)

calculateFormulas

public void calculateFormulas()
Description copied from class: WorkBookHandle
Forces immediate recalculation of every formula in the workbook.

Specified by:
calculateFormulas in interface WorkBook
Overrides:
calculateFormulas in class WorkBookHandle
See Also:
WorkBookHandle.calculateFormulas()

close

public void close()
Description copied from class: WorkBookHandle
Closes the WorkBook and releases resources.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class WorkBookHandle
See Also:
Closeable.close()

copyChartToSheet

public void copyChartToSheet(ChartHandle chart,
                             WorkSheetHandle sheet)
                      throws com.extentech.formats.XLS.ChartNotFoundException,
                             com.extentech.formats.XLS.WorkSheetNotFoundException
Description copied from class: WorkBookHandle
Copies an existing Chart to another WorkSheet

Specified by:
copyChartToSheet in interface WorkBook
Overrides:
copyChartToSheet in class WorkBookHandle
Parameters:
chart -
sheet -
Throws:
com.extentech.formats.XLS.ChartNotFoundException
com.extentech.formats.XLS.WorkSheetNotFoundException
See Also:
WorkBookHandle.copyChartToSheet(com.extentech.ExtenXLS.ChartHandle, com.extentech.ExtenXLS.WorkSheetHandle)

copyChartToSheet

public void copyChartToSheet(java.lang.String chartname,
                             java.lang.String sheetname)
                      throws com.extentech.formats.XLS.ChartNotFoundException,
                             com.extentech.formats.XLS.WorkSheetNotFoundException
Description copied from class: WorkBookHandle
Copies an existing Chart to another WorkSheet

Specified by:
copyChartToSheet in interface WorkBook
Overrides:
copyChartToSheet in class WorkBookHandle
Parameters:
chartname -
sheetname -
Throws:
com.extentech.formats.XLS.ChartNotFoundException
com.extentech.formats.XLS.WorkSheetNotFoundException
See Also:
WorkBookHandle.copyChartToSheet(java.lang.String, java.lang.String)

copyWorkSheet

public WorkSheetHandle copyWorkSheet(java.lang.String SourceSheetName,
                                     java.lang.String NewSheetName)
                              throws com.extentech.formats.XLS.WorkSheetNotFoundException
Description copied from class: WorkBookHandle
Copy (duplicate) a worksheet in the workbook and add it to the end of the workbook with a new name

Specified by:
copyWorkSheet in interface WorkBook
Overrides:
copyWorkSheet in class WorkBookHandle
Parameters:
SourceSheetName -
NewSheetName -
Returns:
Throws:
com.extentech.formats.XLS.WorkSheetNotFoundException
See Also:
WorkBookHandle.copyWorkSheet(java.lang.String, java.lang.String)

createChart

public ChartHandle createChart(java.lang.String name,
                               WorkSheetHandle wsh)
Description copied from class: WorkBookHandle
Creates a new Chart and places it at the end of the workbook

Overrides:
createChart in class WorkBookHandle
Parameters:
name -
wsh -
Returns:
See Also:
WorkBookHandle.createChart(java.lang.String, com.extentech.ExtenXLS.WorkSheetHandle)

createNamedRange

public NameHandle createNamedRange(java.lang.String name,
                                   java.lang.String rangeDef)
Description copied from class: WorkBookHandle
Create a named range in the workbook Note that the named range designation can conform to excel specs, that is, boolean values, references, or string variables can be set. Remember to utilize the sheet name when setting referential names. NameHandle nh = createNamedRange("cellRange", "Sheet1!A1:B3"); NameHandle nh = createNamedRange("trueRange", "=true");

Overrides:
createNamedRange in class WorkBookHandle
Parameters:
name -
rangeDef -
Returns:
See Also:
WorkBookHandle.createNamedRange(java.lang.String, java.lang.String)

deleteChart

public void deleteChart(java.lang.String chartname,
                        WorkSheetHandle wsh)
                 throws com.extentech.formats.XLS.ChartNotFoundException
Description copied from class: WorkBookHandle
delete an existing chart of the workbook

Overrides:
deleteChart in class WorkBookHandle
Parameters:
chartname -
wsh -
Throws:
com.extentech.formats.XLS.ChartNotFoundException
See Also:
WorkBookHandle.deleteChart(java.lang.String, com.extentech.ExtenXLS.WorkSheetHandle)

getAllStrings

public java.lang.String[] getAllStrings()
Description copied from class: WorkBookHandle
Returns all strings that are in the SharedStringTable for this workbook. The SST contains all standard string records in cells, but may not include such things as strings that are contained within formulas. This is useful for such things as full text indexing of workbooks

Overrides:
getAllStrings in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getAllStrings()

getBytes

public byte[] getBytes()
Deprecated. 

Description copied from class: WorkBookHandle
Gets the spreadsheet as a byte array in BIFF8 (Excel '97-2003) format.

Specified by:
getBytes in interface WorkBook
Overrides:
getBytes in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getBytes()

getCell

public CellHandle getCell(java.lang.String address)
                   throws com.extentech.formats.XLS.CellNotFoundException,
                          com.extentech.formats.XLS.WorkSheetNotFoundException
Description copied from class: WorkBookHandle
Returns the Cell at the specified Location

Specified by:
getCell in interface WorkBook
Overrides:
getCell in class WorkBookHandle
Parameters:
address -
Returns:
Throws:
com.extentech.formats.XLS.CellNotFoundException
com.extentech.formats.XLS.WorkSheetNotFoundException
See Also:
WorkBookHandle.getCell(java.lang.String)

getCellRanges

public CellRange[] getCellRanges()
Description copied from class: WorkBookHandle
Returns an Array of the CellRanges existing in this WorkBook specifically the Ranges referenced in Formulas, Charts, and Named Ranges. This is necessary to allow for automatic updating of references when adding/removing/moving Cells within these ranges, as well as shifting references to Cells in Formulas when Formula records are moved.

Overrides:
getCellRanges in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getCellRanges()

getCells

public CellHandle[] getCells()
Description copied from class: WorkBookHandle
Returns an array containing all cells in the WorkBook

Specified by:
getCells in interface WorkBook
Overrides:
getCells in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getCells()

getChart

public ChartHandle getChart(java.lang.String chartname)
                     throws com.extentech.formats.XLS.ChartNotFoundException
Description copied from class: WorkBookHandle
Returns a Chart Handle

Specified by:
getChart in interface WorkBook
Overrides:
getChart in class WorkBookHandle
Parameters:
chartname -
Returns:
Throws:
com.extentech.formats.XLS.ChartNotFoundException
See Also:
WorkBookHandle.getChart(java.lang.String)

getChartById

public ChartHandle getChartById(int id)
                         throws com.extentech.formats.XLS.ChartNotFoundException
Description copied from class: WorkBookHandle
retrieve a ChartHandle via id

Overrides:
getChartById in class WorkBookHandle
Parameters:
id -
Returns:
Throws:
com.extentech.formats.XLS.ChartNotFoundException
See Also:
WorkBookHandle.getChartById(int)

getCharts

public ChartHandle[] getCharts()
Description copied from class: WorkBookHandle
Returns all Chart Handles contained in the WorkBook

Specified by:
getCharts in interface WorkBook
Overrides:
getCharts in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getCharts()

getConditionalFormats

public FormatHandle[] getConditionalFormats()
Description copied from class: WorkBookHandle
Returns an array of all Conditional Formats in the workbook these are formats referenced and used by the conditionally formatted ranges in the workbook.

Overrides:
getConditionalFormats in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getConditionalFormats()

getFactory

public com.extentech.formats.XLS.WorkBookFactory getFactory()
Description copied from class: WorkBookHandle
Gets the internal Factory object.

WARNING: This method is not part of the public API. Its use is not supported and behavior is subject to change.

Overrides:
getFactory in class WorkBookHandle
Returns:
See Also:
com.extentech.ExtenXLS.DocumentHandle#getFactory()

getFormats

public FormatHandle[] getFormats()
Description copied from class: WorkBookHandle
Returns an array of all FormatHandles in the workbook

Specified by:
getFormats in interface WorkBook
Overrides:
getFormats in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getFormats()

getFormulaHandle

public FormulaHandle getFormulaHandle(java.lang.String celladdress)
                               throws com.extentech.formats.XLS.FormulaNotFoundException
Description copied from class: WorkBookHandle
Returns a Formula Handle

Overrides:
getFormulaHandle in class WorkBookHandle
Parameters:
celladdress -
Returns:
Throws:
com.extentech.formats.XLS.FormulaNotFoundException
See Also:
WorkBookHandle.getFormulaHandle(java.lang.String)

getImage

public java.io.File getImage(java.lang.String fname,
                             int thumbWidth,
                             int thumbHeight,
                             int frameWidth,
                             int frameHeight)
                      throws java.lang.Exception
Description copied from class: WorkBookHandle
Generate a thumbnail JPEG image of the first worksheet in the workbook Feb 8, 2011

Overrides:
getImage in class WorkBookHandle
Parameters:
fname -
thumbWidth -
thumbHeight -
frameWidth -
frameHeight -
Returns:
Throws:
java.lang.Exception
See Also:
WorkBookHandle.getImage(java.lang.String, int, int, int, int)

getImage

public ImageHandle getImage(java.lang.String imagename)
                     throws com.extentech.formats.XLS.ImageNotFoundException
Description copied from class: WorkBookHandle
Returns an ImageHandle for manipulating images in the WorkBook

Overrides:
getImage in class WorkBookHandle
Parameters:
imagename -
Returns:
Throws:
com.extentech.formats.XLS.ImageNotFoundException
See Also:
WorkBookHandle.getImage(java.lang.String)

getImages

public ImageHandle[] getImages()
Description copied from class: WorkBookHandle
Returns all ImageHandles in the workbook

Overrides:
getImages in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getImages()

getLEOFile

public com.extentech.formats.LEO.LEOFile getLEOFile()
Description copied from class: WorkBookHandle
Gets the internal LEOFile object.

WARNING: This method is not part of the public API. Its use is not supported and behavior is subject to change.

Overrides:
getLEOFile in class WorkBookHandle
Returns:
See Also:
com.extentech.ExtenXLS.DocumentHandle#getLEOFile()

getNamedRange

public NameHandle getNamedRange(java.lang.String rangename)
                         throws com.extentech.formats.XLS.CellNotFoundException
Description copied from class: WorkBookHandle
Returns a Named Range Handle

Specified by:
getNamedRange in interface WorkBook
Overrides:
getNamedRange in class WorkBookHandle
Parameters:
rangename -
Returns:
Throws:
com.extentech.formats.XLS.CellNotFoundException
See Also:
WorkBookHandle.getNamedRange(java.lang.String)

getNamedRangeInScope

public NameHandle getNamedRangeInScope(java.lang.String rangename)
                                throws com.extentech.formats.XLS.CellNotFoundException
Description copied from class: WorkBookHandle
Returns a Named Range Handle if it exists in the specified scope. This can be used to distinguish between multiple named ranges with the same name but differing scopes

Overrides:
getNamedRangeInScope in class WorkBookHandle
Parameters:
rangename -
Returns:
Throws:
com.extentech.formats.XLS.CellNotFoundException
See Also:
WorkBookHandle.getNamedRangeInScope(java.lang.String)

getNamedRanges

public NameHandle[] getNamedRanges()
Description copied from class: WorkBookHandle
Returns all Named Range Handles

Specified by:
getNamedRanges in interface WorkBook
Overrides:
getNamedRanges in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getNamedRanges()

getNamedRangesInScope

public NameHandle[] getNamedRangesInScope()
Description copied from class: WorkBookHandle
Returns all Named Range Handles scoped to WorkBook. Note this will not include worksheet scoped named ranges

Overrides:
getNamedRangesInScope in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getNamedRangesInScope()

getNoSheetWorkBook

public WorkBookHandle getNoSheetWorkBook()
Description copied from class: WorkBookHandle
Returns a WorkBookHandle containing an empty version of this WorkBook. Use in conjunction with addSheetFromWorkBook() to create new output WorkBooks containing various sheets from a master template. ie: WorkBookHandle emptytemplate = this.getNoSheetWorkBook(); emptytemplate.addSheetFromWorkBook(this, "Sheet1", "TargetSheet");

Specified by:
getNoSheetWorkBook in interface WorkBook
Overrides:
getNoSheetWorkBook in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getNoSheetWorkBook()

getNumCells

public int getNumCells()
Description copied from class: WorkBookHandle
Returns the number of Cells in this WorkBook

Specified by:
getNumCells in interface WorkBook
Overrides:
getNumCells in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getNumCells()

getPivotTable

public PivotTableHandle getPivotTable(java.lang.String ptname)
                               throws com.extentech.formats.XLS.PivotTableNotFoundException
Description copied from class: WorkBookHandle
get a handle to a PivotTable in the WorkBook

Specified by:
getPivotTable in interface WorkBook
Overrides:
getPivotTable in class WorkBookHandle
Parameters:
ptname -
Returns:
Throws:
com.extentech.formats.XLS.PivotTableNotFoundException
See Also:
WorkBookHandle.getPivotTable(java.lang.String)

getPivotTables

public PivotTableHandle[] getPivotTables()
                                  throws com.extentech.formats.XLS.PivotTableNotFoundException
Description copied from class: WorkBookHandle
get an array of handles to all PivotTables in the WorkBook

Specified by:
getPivotTables in interface WorkBook
Overrides:
getPivotTables in class WorkBookHandle
Returns:
Throws:
com.extentech.formats.XLS.PivotTableNotFoundException
See Also:
WorkBookHandle.getPivotTables()

getProperties

public java.util.Map getProperties()
Description copied from class: DocumentHandle
Retrieves a Map containing the workbook properties store. This is not an Excel-compatible feature.

Overrides:
getProperties in class DocumentHandle
Returns:
See Also:
DocumentHandle.getProperties()

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from class: DocumentHandle
Retrieves a property in the workbook property store. This is not an Excel-compatible feature.

Specified by:
getProperty in interface Document
Specified by:
getProperty in interface WorkBook
Overrides:
getProperty in class DocumentHandle
Parameters:
name -
Returns:
See Also:
DocumentHandle.getProperty(java.lang.String)

getStats

public java.lang.String getStats()
Description copied from class: WorkBookHandle
Return useful statistics about this workbook.

Overrides:
getStats in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getStats()

getStats

public java.lang.String getStats(boolean usehtml)
Description copied from class: WorkBookHandle
Return useful statistics about this workbook.

Overrides:
getStats in class WorkBookHandle
Parameters:
usehtml -
Returns:
See Also:
WorkBookHandle.getStats(boolean)

getWorkingDirectory

public java.lang.String getWorkingDirectory()
Returns:
See Also:
com.extentech.ExtenXLS.DocumentHandle#getWorkingDirectory()

getXLSVersionString

public java.lang.String getXLSVersionString()
Description copied from class: WorkBookHandle
Returns the lowest version of Excel compatible with the input file.

Overrides:
getXLSVersionString in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.getXLSVersionString()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
See Also:
Object.hashCode()

is1904

public boolean is1904()
Description copied from class: WorkBookHandle
Returns whether this WorkBook is using the '1904' date system. Useful on Macs.

Overrides:
is1904 in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.is1904()

markFormulasDirty

public void markFormulasDirty()
Description copied from class: WorkBookHandle
Marks every formula in the workbook as needing a recalc. This method does not actually calculate formulas, for that use WorkBookHandle.recalc().

Overrides:
markFormulasDirty in class WorkBookHandle
See Also:
WorkBookHandle.markFormulasDirty()

recalc

public void recalc()
Description copied from class: WorkBookHandle
Recalculates all dirty formulas in the workbook immediately.

You generally need not call this method. Dirty formulas will automatically be recalculated when their values are queried. This method is only useful for forcing calculation to occur at a certain time. In the case of functions such as NOW() whose value is volatile the formula will still be recalculated every time it is queried.

Overrides:
recalc in class WorkBookHandle
See Also:
WorkBookHandle.recalc()

reset

public void reset()
Description copied from class: DocumentHandle
Resets the document state to what it was when it was loaded.

Specified by:
reset in interface Document
Specified by:
reset in interface WorkBook
Overrides:
reset in class WorkBookHandle
See Also:
DocumentHandle.reset()

searchAndReplace

public int searchAndReplace(java.lang.String searchfor,
                            java.lang.String replacewith)
Description copied from class: WorkBookHandle
Searches all Cells in the workbook for the string occurrence and replaces with the replacement text.

Overrides:
searchAndReplace in class WorkBookHandle
Parameters:
searchfor -
replacewith -
Returns:
See Also:
WorkBookHandle.searchAndReplace(java.lang.String, java.lang.String)

setDebugLevel

public void setDebugLevel(int l)
Description copied from class: DocumentHandle
Sets the debugging output level. Higher values will produce more output. Output at higher values will generally only be of use to ExtenXLS developers. Increased output incurs a performance penalty, so it is recommended this be left at zero unless you are reporting a bug.

Specified by:
setDebugLevel in interface Document
Specified by:
setDebugLevel in interface WorkBook
Overrides:
setDebugLevel in class DocumentHandle
Parameters:
l -
See Also:
DocumentHandle.setDebugLevel(int)

setDefaultColWidth

public void setDefaultColWidth(int t)
Description copied from class: WorkBookHandle
set Default col width Note: only affects undefined Columns containing Cells
default width of the columns in 1/256 of the width of the zero character, using default font.
The Default Excel Column, whose width in Characters or Excel Units, is 8.43, has a width in these units of 2300.

Specified by:
setDefaultColWidth in interface WorkBook
Overrides:
setDefaultColWidth in class WorkBookHandle
Parameters:
t -
See Also:
WorkBookHandle.setDefaultColWidth(int)

setDefaultRowHeight

public void setDefaultRowHeight(int t)
Description copied from class: WorkBookHandle
set Default row height in twips (=1/20 of a point) Note: only affects undefined Rows containing Cells

Specified by:
setDefaultRowHeight in interface WorkBook
Overrides:
setDefaultRowHeight in class WorkBookHandle
Parameters:
t -
See Also:
WorkBookHandle.setDefaultRowHeight(int)

setDupeStringMode

public void setDupeStringMode(int mode)
Description copied from class: WorkBookHandle
Set Duplicate String Handling Mode.
        The Duplicate String Mode determines the behavior of
        the String table when inserting new Strings.

        The String table shares a single entry for multiple
        Cells containing the same string.  When multiple Cells
        have the same value, they share the same underlying string.

        Changing the value of any one of the Cells will change
        the value for any Cells sharing that reference.

        For this reason, you need to determine
        the handling of new strings added to the sheet that
        are duplicates of strings already in the table.

        If you will be changing the values of these
        new Cells, you will need to set the Duplicate
        String Mode to ALLOWDUPES.  If the string table
        encounters a duplicate entry being added, it
        will insert a duplicate that can then be subsequently
        changed without affecting the other duplicate Cells.

        Valid Modes Are:

            WorkBookHandle.ALLOWDUPES - faster String inserts, larger file sizes,  changing Cells has no effect on dupe Cells                   

            WorkBookHandle.SHAREDUPES - slower inserts, dupe smaller file sizes, Cells share changes
            

Specified by:
setDupeStringMode in interface WorkBook
Overrides:
setDupeStringMode in class WorkBookHandle
Parameters:
mode -
See Also:
WorkBookHandle.setDupeStringMode(int)

setProperties

public void setProperties(java.util.Map properties)
Description copied from class: DocumentHandle
Replaces the workbook properties with the values in a given Map. This is not an Excel-compatible feature.

Overrides:
setProperties in class DocumentHandle
Parameters:
properties -
See Also:
DocumentHandle.setProperties(java.util.Map)

setProtected

public void setProtected(boolean b)
Description copied from class: WorkBookHandle
set the workbook to protected mode Note: the password cannot be decrypted or changed in Excel -- protection can only be set/removed using ExtenXLS

Specified by:
setProtected in interface WorkBook
Overrides:
setProtected in class WorkBookHandle
Parameters:
b -
See Also:
WorkBookHandle.setProtected(boolean)

setShowSheetTabs

public void setShowSheetTabs(boolean show)
Description copied from class: WorkBookHandle
Sets whether the sheet selection tabs should be shown.

Overrides:
setShowSheetTabs in class WorkBookHandle
Parameters:
show -
See Also:
WorkBookHandle.setShowSheetTabs(boolean)

setFormulaCalculationMode

public void setFormulaCalculationMode(int CalcMode)
Description copied from class: WorkBookHandle
Set the calculation mode for the workbook. CALCULATE_AUTO is the default for new workbooks. Calling Cell.getVal() will calculate formulas if they exist within the cell. CALCULATE_EXPLICIT will return present, cached value of the cell. Formula calculation will ONLY occur when explicitly called through the Formula Handle.calculate() method. CALCULATE_ALWAYS will ignore the cache and force a recalc every time a cell value is requested. WorkBookHandle.CALCULATE_AUTO WorkBookHandle.CALCULATE_ALWAYS WorkBookHandle.CALCULATE_EXPLICIT

Specified by:
setFormulaCalculationMode in interface WorkBook
Overrides:
setFormulaCalculationMode in class WorkBookHandle
Parameters:
CalcMode - Calculation mode to use in workbook.

setStringEncodingMode

public void setStringEncodingMode(int mode)
Description copied from class: WorkBookHandle
Set Encoding mode of new Strings added to file. ExtenXLS has 3 modes for handling the internal encoding of String data that is added to the file. ExtenXLS can save space in the file if it knows that all characters in your String data can be represented with a single byte (Compressed.) If your String contains characters which need 2 bytes to represent (such as Eastern-language characters) then it needs to be stored in an uncompressed Unicode format. ExtenXLS can either automatically detect the mode for each String, or you can set it explicitly. The auto mode is the most flexible but requires processing overhead. Default mode is WorkBookHandle.STRING_ENCODING_AUTO. Valid Modes Are: WorkBookHandle.STRING_ENCODING_AUTO Use if you are adding mixed Unicode and non-unicode Strings and can accept the performance hit -slowest String adds -optimal file size for mixed Strings WorkBookHandle.STRING_ENCODING_UNICODE Use if all of your new Strings are Unicode - faster than AUTO -faster than AUTO -largest file size WorkBookHandle.STRING_ENCODING_COMPRESSED Use if all of your new Strings are non-Unicode and can have high-bytes compressed -faster than AUTO -smallest file size

Specified by:
setStringEncodingMode in interface WorkBook
Overrides:
setStringEncodingMode in class WorkBookHandle
Parameters:
mode -
See Also:
WorkBookHandle.setStringEncodingMode(int)

showSheetTabs

public boolean showSheetTabs()
Description copied from class: WorkBookHandle
Returns whether the sheet selection tabs should be shown.

Overrides:
showSheetTabs in class WorkBookHandle
Returns:
See Also:
WorkBookHandle.showSheetTabs()

write

public void write(java.io.OutputStream out,
                  boolean Excel2007Format)
Deprecated. 

Description copied from class: WorkBookHandle
Writes the document to the given stream in either XLS or XLSX format.

Overrides:
write in class WorkBookHandle
Parameters:
out -
Excel2007Format -
See Also:
WorkBookHandle.write(java.io.OutputStream, boolean)

write

public void write(java.io.OutputStream out,
                  int format)
Description copied from class: WorkBookHandle
Writes the document to the given stream in the requested format.

format choices:

WorkBookHandle.FORMAT_XLS for 2003 and previous versions
WorkBookHandle.FORMAT_XLSX for non-macro-enabled 2007 version
WorkBookHandle.FORMAT_XLSM for macro-enabled 2007 version
WorkBookHandle.FORMAT_XLTM for macro-enabled 2007 templates.
WorkBookHandle.FORMAT_XLTX for 2007 templates,

IMPORTANT NOTE: if the resulting filename contains the .XLSM extension
the WorkBook MUST be written in FORMAT_XLSM; otherwise open errors will occur

NOTE: If the format is FORMAT_XLSX and the filename contains macros
the file will be written as Macro-Enabled i.e. in FORMAT_XLSM. In these cases,
the filename must contain the .XLSM extension

Overrides:
write in class WorkBookHandle
Parameters:
out -
format -
See Also:
WorkBookHandle.write(java.io.OutputStream, int)

write

public void write(java.io.OutputStream out)
Description copied from class: DocumentHandle
Writes the document to the given stream in its native format.

Overrides:
write in class DocumentHandle
Parameters:
out -
See Also:
DocumentHandle.write(java.io.OutputStream)

write

public void write(java.lang.String fname,
                  boolean Excel2007Format)
Description copied from class: WorkBookHandle
Writes the document to the given file in either XLS or XLSX. For OOXML, if the file has a VBA project the file extension must be ".xlsm". It will be changed if necessary.

Overrides:
write in class WorkBookHandle
Parameters:
fname -
Excel2007Format -
See Also:
WorkBookHandle.write(java.lang.String, boolean)

write

public void write(java.lang.String fname)
Description copied from class: WorkBookHandle
Writes the document to the given path. If the filename ends with ".xlsx" or ".xlsm", the workbook will be written as OOXML (XLSX). Otherwise it will be written as BIFF8 (XLS). For OOXML, if the file has a VBA project the file extension must be ".xlsm". It will be changed if necessary.

Overrides:
write in class WorkBookHandle
Parameters:
fname -
See Also:
WorkBookHandle.write(java.lang.String)

writeBytes

public java.lang.StringBuffer writeBytes(java.io.OutputStream bout)
Description copied from class: WorkBookHandle
Writes the document to the given stream in BIFF8 (XLS) format.

To output a debugging StringBuffer, you must first set the autolockdown setting:
props.put("com.extentech.ExtenXLS.autocreatelockdown","true");

Specified by:
writeBytes in interface WorkBook
Overrides:
writeBytes in class WorkBookHandle
Parameters:
bout -
Returns:
See Also:
WorkBookHandle.writeBytes(java.io.OutputStream)

writeXLSXBytes

public void writeXLSXBytes(java.io.OutputStream bout,
                           int format)
                    throws java.lang.Exception
Description copied from class: WorkBookHandle
Writes the document to the given stream in the requested OOXML format.

Overrides:
writeXLSXBytes in class WorkBookHandle
Parameters:
bout -
format -
Throws:
java.lang.Exception
java.lang.IllegalArgumentException - if the given type code is invalid
java.io.IOException - if an error occurs while writing to the stream
See Also:
WorkBookHandle.writeXLSXBytes(java.io.OutputStream, int)

writeXLSXBytes

public void writeXLSXBytes(java.io.OutputStream bout)
                    throws java.lang.Exception
Description copied from class: WorkBookHandle
Writes the document to the given stream in the default OOXML format.

Overrides:
writeXLSXBytes in class WorkBookHandle
Parameters:
bout -
Throws:
java.lang.Exception
java.io.IOException - if an error occurs while writing to the stream
See Also:
WorkBookHandle.writeXLSXBytes(java.io.OutputStream)

setCurrentObject

public void setCurrentObject(Cell o)
sets the currently parsed object

Parameters:
o -

getVal

public Cell getVal()


Copyright © 2011 Extentech Inc. All Rights Reserved.