public class Workbook extends java.lang.Object implements INotifyPropertyValueChanged, com.mindfusion.common.ISupportInitialize, java.awt.print.Printable
| Constructor and Description |
|---|
Workbook()
Initializes a new instance of the
Workbook class. |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangedListener(java.beans.PropertyChangeListener listener)
Registers listener so that it will receive events from the workbook.
|
void |
addWorkbookListener(WorkbookListener listener)
Registers listener so that it will receive events from the workbook.
|
void |
beginInit() |
void |
cancelChangeOperation(TrackChangesCommand command)
Stops tracking changes by the specified command and reverts all changes done so far.
|
void |
cancelCompositeOperation()
Stops recording the most recently started composite operation and discards the records created so far.
|
void |
commitChangeOperation(TrackChangesCommand command)
Stops tracking changes by the specified command and saves the command in the history queue.
|
void |
commitCompositeOperation()
Stops recording the most recently started composite operation and saves the composite in the history queue.
|
void |
endInit() |
void |
evaluateFormulas()
Reevaluates all formulas containing custom and volatile functions and their dependent cells.
|
void |
executeCommand(Command command)
Executes the specified command on this workbook.
|
Cell |
find(java.lang.String search,
Cell reference,
FindWithin findWithin,
LookIn lookIn,
SearchOrder order,
SearchDirection direction,
boolean matchCase,
boolean wholeCells)
Performs a search for a cell containing the specified text, using the specified criteria.
|
java.lang.Iterable<Cell> |
findAll(java.lang.String search,
Worksheet reference,
FindWithin findWithin,
LookIn lookIn,
SearchOrder order,
SearchDirection direction,
boolean matchCase,
boolean wholeCells)
Finds and returns all cells containing the specified text, using the specified criteria.
|
int |
getCalculationMaxIterations()
Gets the maximum number of iterations when calculating certain functions, such as IRR and RATE.
|
double |
getCalculationPrecision()
Gets the precision when calculating certain functions, such as IRR and RATE.
|
boolean |
getCanRedo()
Gets a value indicating whether there is a command in the undo history which can be redone.
|
boolean |
getCanUndo()
Gets a value indicating whether there is a command in the undo history which can be undone.
|
com.mindfusion.common.ExtendedArrayList<NumericFormatInfo> |
getCustomNumericFormats()
Gets the workbook user defined custom numeric formats.
|
java.lang.Iterable<CellStorage> |
getData()
Gets all data in the workbook.
|
DefaultNumericFormats |
getDefaultNumericFormats()
Gets the workbook defined default numeric formats.
|
boolean |
getEnableFormulaEvaluation()
Gets a value indicating whether formula evaluation is enabled.
|
boolean |
getEnableReferenceRefactoring()
Gets a value indicating whether to skip formula references refactoring.
|
boolean |
getEnableTypeInference()
Gets a value indicating whether cell data is automatically interpreted as
a value of a specific type, or accepted as text.
|
IExpressionEvaluator |
getExtendedEvaluator()
Gets a custom expression evaluator.
|
IInformationProvider |
getExtendedInformationProvider()
Gets an information provider for custom functions.
|
java.util.Locale |
getLocale()
Gets the workbook locale.
|
Localization |
getLocalization()
Gets the workbook localization object.
|
NamedRangeCollection |
getNamedRanges()
Gets an object that an be used to manage the named ranges in this workbook.
|
PrintOptions |
getPrintOptions()
Returns a
PrintOptions instance that allows customizing various aspects of printing and print-preview. |
boolean |
getShowLeadingApostrophes()
Gets a value indicating whether cells should show their leading apostrophe.
|
boolean |
getUndoEnabled()
Gets a value indicating whether saving action records for later undo is enabled.
|
WorksheetCollection |
getWorksheets()
Gets an object that can be used to create and manage the worksheets in this workbook.
|
void |
loadFromXml(org.w3c.dom.Document document)
Loads the workbook from an XML document.
|
void |
loadFromXml(java.lang.String fileName)
Loads the workbook from an XML file.
|
protected void |
onActionRedone(UndoEvent e)
Raises the
actionRedone event. |
protected void |
onActionUndone(UndoEvent e)
Raises the
actionUndone event. |
protected void |
onDeserializeColumnTag(SerializeColumnTagEvent e)
Raises the
deserializeColumnTag event. |
protected void |
onDeserializeData(SerializeDataEvent e)
Raises the
deserializeData event. |
protected void |
onDeserializeRowTag(SerializeRowTagEvent e)
Raises the
deserializeRowTag event. |
protected void |
onDeserializeTag(SerializeTagEvent e)
Raises the
deserializeTag event. |
protected void |
onPropertyValueChanged(java.beans.PropertyChangeEvent e)
Raises the
propertyChange event. |
protected void |
onSerializeColumnTag(SerializeColumnTagEvent e)
Raises the
serializeColumnTag event. |
protected void |
onSerializeData(SerializeDataEvent e)
Raises the
serializeData event. |
protected void |
onSerializeRowTag(SerializeRowTagEvent e)
Raises the
serializeRowTag event. |
protected void |
onSerializeTag(SerializeTagEvent e)
Raises the
serializeTag event. |
protected void |
onWorksheetCellChanged(CellChangedEvent e)
Raises the
worksheetCellChanged event. |
protected void |
onWorksheetCellChangedPostCalc(CellChangedEvent e)
Raises the
worksheetCellChangedPostCalc event. |
protected void |
onWorksheetCellChangedPreCalc(CellChangedEvent e)
Raises the
worksheetCellChangedPreCalc event. |
protected void |
onWorksheetCellChanging(CellValidationEvent e)
Raises the
worksheetCellChanging event. |
protected void |
onWorksheetCellParsing(CellParsingEvent e) |
protected void |
onWorksheetCellsCleared(WorksheetEvent e)
Raises the
worksheetCellsCleared event. |
protected void |
onWorksheetCellStyleChanged(StyleChangedEvent e)
Raises the
worksheetCellStyleChanged event. |
protected void |
onWorksheetCellStyleChanging(CellValidationEvent e)
Raises the
worksheetCellStyleChanging event. |
protected void |
onWorksheetChanged(WorksheetChangedEvent e)
Raises the
worksheetChanged event. |
protected void |
onWorksheetColumnChanged(ColumnChangedEvent e)
Raises the
worksheetColumnChanged event. |
protected void |
onWorksheetRowChanged(RowChangedEvent e)
Raises the
worksheetRowChanged event. |
protected void |
onWorksheetValidationFailed(ValidationFailedEvent e)
Raises the
worksheetValidationFailed event. |
void |
print()
Prints the current workbook using the default page format.
|
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
void |
print(java.awt.print.PageFormat pageFormat,
java.lang.String printer)
Prints the current workbook using the specified page format.
|
void |
print(java.lang.String printer)
Prints the current workbook using the default page format.
|
void |
redo()
Executes again an action saved in the command history.
|
void |
removePropertyChangedListener(java.beans.PropertyChangeListener listener)
Unregisters listener so that it will no longer receive workbook events.
|
void |
removeWorkbookListener(WorkbookListener listener)
Unregisters listener so that it will no longer receive workbook events.
|
Cell |
replace(java.lang.String search,
java.lang.String replaceWith,
Cell cell,
FindWithin findWithin,
SearchOrder order,
SearchDirection direction,
boolean matchCase,
boolean wholeCells)
Replaces the data of the specified cell if it matches the specified criteria and returns the next matching cell.
|
void |
replaceAll(java.lang.String search,
java.lang.String replaceWith,
Worksheet reference,
FindWithin findWithin,
boolean matchCase,
boolean wholeCells)
Replaces the data of all cells matching the specified criteria.
|
void |
resumeUpdates()
Resumes updates on all worksheets in the workbook.
|
void |
saveToXml(org.w3c.dom.Document document)
Saves the workbook into an XML document.
|
void |
saveToXml(java.lang.String fileName)
Saves the workbook into an XML file.
|
void |
setCalculationMaxIterations(int value)
Sets the maximum number of iterations when calculating certain functions, such as IRR and RATE.
|
void |
setCalculationPrecision(double value)
Sets the precision when calculating certain functions, such as IRR and RATE.
|
void |
setEnableFormulaEvaluation(boolean value)
Sets a value indicating whether formula evaluation is enabled.
|
void |
setEnableReferenceRefactoring(boolean value)
Sets a value indicating whether to skip formula references refactoring.
|
void |
setEnableTypeInference(boolean value)
Sets a value indicating whether cell data is automatically interpreted as
a value of a specific type, or accepted as text.
|
void |
setExtendedEvaluator(IExpressionEvaluator value)
Sets a custom expression evaluator.
|
void |
setExtendedInformationProvider(IInformationProvider value)
Sets an information provider for custom functions.
|
void |
setLocale(java.util.Locale value)
Sets the workbook locale.
|
void |
setLocalizationInfo(java.lang.String xmlFile)
Localizes the UI elements that are related to this workbook with
the strings contained in the specified XML file.
|
void |
setShowLeadingApostrophes(boolean value)
Sets a value indicating whether cells should show their leading apostrophe.
|
void |
setUndoEnabled(boolean value)
Sets a value indicating whether saving action records for later undo is enabled.
|
TrackChangesCommand |
startChangeOperation(INotifyPropertyValueChanged target)
Creates a
Command object to track subsequent changes on the specified target. |
CompositeCommand |
startCompositeOperation()
Starts recording undo/redo commands into a CompositeCommand.
|
void |
suspendUpdates()
Suspends updates on all worksheets in the workbook.
|
void |
undo()
Undoes an action saved in the command history.
|
public Workbook()
Workbook class.public void addWorkbookListener(WorkbookListener listener)
listener - An object implementing the WorkbookListener interface.public void removeWorkbookListener(WorkbookListener listener)
listener - An object implementing the WorkbookListener interface.public void addPropertyChangedListener(java.beans.PropertyChangeListener listener)
addPropertyChangedListener in interface INotifyPropertyValueChangedlistener - An object implementing the PropertyChangeListener interface.public void removePropertyChangedListener(java.beans.PropertyChangeListener listener)
removePropertyChangedListener in interface INotifyPropertyValueChangedlistener - An object implementing the PropertyChangeListener interface.public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
throws java.awt.print.PrinterException
print in interface java.awt.print.Printablejava.awt.print.PrinterExceptionpublic void print()
public void print(java.lang.String printer)
printer - Specifies the destination printerpublic void print(java.awt.print.PageFormat pageFormat,
java.lang.String printer)
pageFormat - The size and orientation of each page to be printed.printer - Specifies the destination printerpublic void suspendUpdates()
The underlying Worksheets collection should not be modified when updates are suspended.
public void resumeUpdates()
The underlying Worksheets collection should not be modified when updates are suspended.
public void beginInit()
beginInit in interface com.mindfusion.common.ISupportInitializepublic void endInit()
endInit in interface com.mindfusion.common.ISupportInitializepublic void evaluateFormulas()
public java.lang.Iterable<CellStorage> getData()
public Cell find(java.lang.String search, Cell reference, FindWithin findWithin, LookIn lookIn, SearchOrder order, SearchDirection direction, boolean matchCase, boolean wholeCells)
search - The text to search.reference - The cell to start the search from.findWithin - The target of the search - the referenced worksheet or the entire workbook.lookIn - Specifies whether to search in the cell's formula or value.order - The search order - horizontal or vertical.direction - The search direction - forward or backward.matchCase - Specifies whether the search should be case-sensitive.wholeCells - Specifies whether to match entire cells only.Cell object representing the found cell, or null, if the text was not found.public java.lang.Iterable<Cell> findAll(java.lang.String search, Worksheet reference, FindWithin findWithin, LookIn lookIn, SearchOrder order, SearchDirection direction, boolean matchCase, boolean wholeCells)
search - The text to search.reference - The worksheet to search.findWithin - The target of the search - the specified worksheet or the entire workbook.lookIn - Specifies whether to search in the cell's formula or value.order - The search order - horizontal or vertical.direction - The search direction - forward or backward.matchCase - Specifies whether the search should be case-sensitive.wholeCells - Specifies whether to match entire cells only.public Cell replace(java.lang.String search, java.lang.String replaceWith, Cell cell, FindWithin findWithin, SearchOrder order, SearchDirection direction, boolean matchCase, boolean wholeCells)
search - The text to search and replace.replaceWith - The value to replace with.cell - The cell containing the data to replace.findWithin - The target of the replace operation - the referenced worksheet or the entire workbook.order - The replace order - horizontal or vertical.direction - The replace direction - forward or backward.matchCase - Specifies whether the match should be case-sensitive.wholeCells - Specifies whether to match entire cells only.Cell object representing the next matching cell, or null,
if the text was not found or if the specified cell does not match.public void replaceAll(java.lang.String search,
java.lang.String replaceWith,
Worksheet reference,
FindWithin findWithin,
boolean matchCase,
boolean wholeCells)
search - The text to search and replace.replaceWith - The text to replace with.reference - The worksheet to search.findWithin - The target of the replace operation - the specified worksheet or the entire workbook.matchCase - Specifies whether the search should be case-sensitive.wholeCells - Specifies whether to match entire cells only.public TrackChangesCommand startChangeOperation(INotifyPropertyValueChanged target)
Command object to track subsequent changes on the specified target.
The returned command will be automatically executed when disposed.target - The object to track.TrackChangesCommand that is used to track the changes,
or null, if undo is disabled.public void cancelChangeOperation(TrackChangesCommand command)
public void commitChangeOperation(TrackChangesCommand command)
public CompositeCommand startCompositeOperation()
public void cancelCompositeOperation()
public void commitCompositeOperation()
public void executeCommand(Command command)
command - The Command to execute.public void undo()
public void redo()
public void saveToXml(java.lang.String fileName)
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationExceptionpublic void saveToXml(org.w3c.dom.Document document)
public void loadFromXml(java.lang.String fileName)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionjava.io.IOExceptionpublic void loadFromXml(org.w3c.dom.Document document)
protected void onActionRedone(UndoEvent e)
actionRedone event.e - An object providing the event data.protected void onActionUndone(UndoEvent e)
actionUndone event.e - An object providing the event data.protected void onPropertyValueChanged(java.beans.PropertyChangeEvent e)
propertyChange event.e - An object providing the event data.protected void onWorksheetChanged(WorksheetChangedEvent e)
worksheetChanged event.e - An object providing the event data.protected void onWorksheetCellStyleChanging(CellValidationEvent e)
worksheetCellStyleChanging event.e - An object providing the event data.protected void onWorksheetCellStyleChanged(StyleChangedEvent e)
worksheetCellStyleChanged event.e - An object providing the event data.protected void onWorksheetCellParsing(CellParsingEvent e)
protected void onWorksheetCellChanging(CellValidationEvent e)
worksheetCellChanging event.e - An object providing the event data.protected void onWorksheetCellChanged(CellChangedEvent e)
worksheetCellChanged event.e - An object providing the event data.protected void onWorksheetCellChangedPreCalc(CellChangedEvent e)
worksheetCellChangedPreCalc event.e - An object providing the event data.protected void onWorksheetCellChangedPostCalc(CellChangedEvent e)
worksheetCellChangedPostCalc event.e - An object providing the event data.protected void onWorksheetCellsCleared(WorksheetEvent e)
worksheetCellsCleared event.e - An object providing the event data.protected void onWorksheetColumnChanged(ColumnChangedEvent e)
worksheetColumnChanged event.e - An object providing the event data.protected void onWorksheetRowChanged(RowChangedEvent e)
worksheetRowChanged event.e - An object providing the event data.protected void onWorksheetValidationFailed(ValidationFailedEvent e)
worksheetValidationFailed event.e - An object providing the event data.protected void onSerializeData(SerializeDataEvent e)
serializeData event.e - An object providing the event data.protected void onDeserializeData(SerializeDataEvent e)
deserializeData event.e - An object providing the event data.protected void onSerializeTag(SerializeTagEvent e)
serializeTag event.e - An object providing the event data.protected void onDeserializeTag(SerializeTagEvent e)
deserializeTag event.e - An object providing the event data.protected void onSerializeColumnTag(SerializeColumnTagEvent e)
serializeColumnTag event.e - An object providing the event data.protected void onDeserializeColumnTag(SerializeColumnTagEvent e)
deserializeColumnTag event.e - An object providing the event data.protected void onSerializeRowTag(SerializeRowTagEvent e)
serializeRowTag event.e - An object providing the event data.protected void onDeserializeRowTag(SerializeRowTagEvent e)
deserializeRowTag event.e - An object providing the event data.public WorksheetCollection getWorksheets()
public NamedRangeCollection getNamedRanges()
public Localization getLocalization()
public java.util.Locale getLocale()
This property is initialized with the culture of the current thread.
public void setLocale(java.util.Locale value)
This property is initialized with the culture of the current thread.
public DefaultNumericFormats getDefaultNumericFormats()
This property is initialized with the defined locale for the workbook.
public com.mindfusion.common.ExtendedArrayList<NumericFormatInfo> getCustomNumericFormats()
This property is initialized with the defined locale for the workbook.
public boolean getCanUndo()
true if the undo queue contains operations that can be undone;
otherwise, false.public boolean getCanRedo()
true if the undo queue contains operations that can be redone; otherwise, false.
public boolean getUndoEnabled()
To undo the last recorded action, call the undo() method. It can be redone again by
calling redo(). Custom operations can be integrated into the MindFusion.Spreadsheet
undo/redo system by deriving from the Command class and running the operations by
means of the executeCommand(com.mindfusion.spreadsheet.Command) method.
true to save actions for later undo; otherwise false.
The default is false.public void setUndoEnabled(boolean value)
To undo the last recorded action, call the undo() method. It can be redone again by
calling redo(). Custom operations can be integrated into the MindFusion.Spreadsheet
undo/redo system by deriving from the Command class and running the operations by
means of the executeCommand(com.mindfusion.spreadsheet.Command) method.
public IExpressionEvaluator getExtendedEvaluator()
public void setExtendedEvaluator(IExpressionEvaluator value)
public IInformationProvider getExtendedInformationProvider()
public void setExtendedInformationProvider(IInformationProvider value)
public int getCalculationMaxIterations()
public void setCalculationMaxIterations(int value)
public double getCalculationPrecision()
public void setCalculationPrecision(double value)
public boolean getEnableFormulaEvaluation()
public void setEnableFormulaEvaluation(boolean value)
public boolean getEnableReferenceRefactoring()
public void setEnableReferenceRefactoring(boolean value)
public boolean getEnableTypeInference()
public void setEnableTypeInference(boolean value)
public boolean getShowLeadingApostrophes()
public void setShowLeadingApostrophes(boolean value)
value - true to show leading apostrophes, or false otherwise.public void setLocalizationInfo(java.lang.String xmlFile)
throws java.io.FileNotFoundException
xmlFile - Path to an XML file containing the localization strings.java.io.FileNotFoundExceptionpublic PrintOptions getPrintOptions()
PrintOptions instance that allows customizing various aspects of printing and print-preview.