Package com.grapecity.documents.excel
Interface IWorkbook
- All Known Implementing Classes:
Workbook
public interface IWorkbook
Represents an IWorkbook object.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataSource(String name, Object dataSource) Add data source for template.voidCalculates formulas of the workbook as needed.voidConvert the calculated barcodes to pictures and place them in their respective positions.voidconvertBarcodeToPicture(ImageType imageType) Convert the calculated barcodes to pictures of pictures and place them in their respective positions.voiddirty()Designates all the formulas of the workbook to be recalculated when the next calculation occurs.fromJson(InputStream stream) Generates a workbook from a json stream.fromJson(InputStream stream, DeserializationOptions deserializationOptions) Generates a workbook from a json stream.Generates a workbook from a json string.fromJson(String json, DeserializationOptions deserializationOptions) Generates a workbook from a json string.voidfromSjsJson(InputStream stream) Generates a workbook from a JSON stream containing the contents of .sjs file format.voidfromSjsJson(InputStream stream, SjsOpenOptions openOptions) Generates a workbook from a JSON stream containing the contents of .sjs file format.voidfromSjsJson(String json) Generates a workbook from a JSON string containing the contents of .sjs file format.voidfromSjsJson(String json, SjsOpenOptions openOptions) Generates a workbook from a JSON string containing the contents of .sjs file format.Process the template and return the instance of report workbook.generateReport(IWorksheet... worksheets) Process the template and return the instance of report workbook.Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook.Occurs after the workbook is saved.booleanDeprecated.Gets the author.booleanGets whether to automatically parse when setting a range value to a string value.booleanGets whether to round the number to 15 significant figures when getting the value.Occurs before the workbook is saved.Returns an object that represents the view settings of this workbook.Gets a collection that represents all the built-in document properties of the workbook.Gets culture info for the workbook.Gets a collection that represents all the custom document properties of the workbook.Gets the custom views of the workbook.Gets the table style name from theITableStyleCollectioncollectionthat is used as the default TableStyle.booleanGets whether update the dirty state of the formula cells immediately when changing the value of a cell.booleanGets whether the calculation engine is valid.Returns the names of the linked excel documents.Returns the name of the workbook, including its path on disk.Provides graphics information.Filters data in a workbook based on a cell icon from the IconSets collection.getName()Gets a string value that represents the name of the workbook.getNames()Returns theINamescollection that represents the workbook-specified names.Occurs when a new sheet is created in the workbook.Occurs when the workbook is opened.Returns theIExcelOptionsobject that represents some settings to control workbook behavior.getPath()Gets a string that represents the path to the workbook file that this workbook object represents.Returns theIPivotCachescollection that represents all theIPivotTablecaches in the specified workbook.booleanTrue if the order of the sheets in the workbook is protected.booleanTrue if the windows of the workbook are protected.Gets the reference style.booleanDetermines whether to reset adjacent range's border when setting border for a range.Returns aIWorksheetscollectionthat represents all the selected sheets in the specified workbook.Occurs when a sheet is activate.Occurs before a sheet is deleted.Occurs when something changes in the cells of a sheet.Occurs when a sheet is deactivated.Occurs when the selection changes on a sheet.booleanGets a value indicating whether the PivotTable field list can be shown.Gets a collection of Signature objects that correspond to the digital signature attached to a document.Gets theISlicerCachesobject associated with the workbook.Returns theIStyleCollectioncollection that represents all thestyles in the specified workbook.Returns theITableStyleCollectioncollection object for the currentworkbook that refers to the styles used in the current workbook.getTheme()Returns the theme applied to the current workbook.Gets all fonts information that used on workbook.Returns theIWorksheetscollection that represents all the worksheetsin the specified workbook.Returns aWriteProtectionobject that provides access to the workbook write protection options.booleanisEncryptedFile(InputStream fileStream) Specifies whether the file is password protected.booleanisEncryptedFile(String fileName) Specifies whether the file is password protected.voidopen(InputStream fileStream) Opens the specified excel file stream.voidopen(InputStream fileStream, OpenFileFormat fileFormat) Opens the specified format file stream.voidopen(InputStream fileStream, OpenOptionsBase options) Opens the stream with specified options.voidopen(InputStream fileStream, String password) Opens the specified excel file stream.voidOpens the specified excel fileopen(String fileName, DeserializationOptions deserializationOptions) Opens the json file.voidopen(String fileName, OpenFileFormat fileFormat) Opens the specified format file.voidopen(String fileName, OpenOptionsBase options) Opens the file with specified options.voidOpens the specified excel filevoidStart to process the template.voidprocessTemplate(CancellationToken cancellationToken) Start to process the template with global options and cancellation support.voidprotect()Protects a workbook so that it cannot be modified.voidprotect(boolean structure) Protects a workbook so that it cannot be modified.voidprotect(boolean structure, boolean windows) Protects a workbook so that it cannot be modified.voidProtects a workbook so that it cannot be modified.voidProtects a workbook so that it cannot be modified.voidProtects a workbook so that it cannot be modified.voidsave(OutputStream outputStream) Saves the workbook to the stream.voidsave(OutputStream fileStream, SaveFileFormat fileFormat) Saves the specified format file stream.voidsave(OutputStream fileStream, SaveOptionsBase options) Saves workbook to stream with specified options.voidsave(OutputStream outputStream, String password) Saves data to the specified excel file stream.voidSaves the workbook to the disk.voidsave(String fileName, SaveFileFormat fileFormat) Saves the specified format file.voidsave(String fileName, SaveOptionsBase options) Saves workbook to file with specified options.voidSaves data to the specified excel file.voidsetAllowDynamicArray(boolean value) Deprecated.method is obsoleted, please useIRange.setFormula2(String)to set dynamic array formula.voidSets the author.voidsetAutoParse(boolean value) Sets whether to automatically parse when setting a range value to a string value.voidsetAutoRoundValue(boolean value) Sets whether to round the number to 15 significant figures when getting the value.voidsetCulture(Locale value) Sets culture info for the workbook.voidsetDefaultTableStyle(String value) Sets the table style name from theITableStyleCollectioncollectionthat is used as the default TableStyle.voidsetDeferUpdateDirtyState(boolean value) Sets whether update the dirty state of the formula cells immediately when changing the value of a cell.voidsetEnableCalculation(boolean value) Sets whether the calculation engine is valid.voidsetGraphicsInfo(IGraphicsInfo value) Provides graphics information.voidSets a string value that represents the name of the workbook.voidSets a string that represents the path to the workbook file that this workbook object represents.voidsetReferenceStyle(ReferenceStyle value) Sets the reference style.voidsetResetAdjacentRangeBorder(boolean value) Determines whether to reset adjacent range's border when setting border for a range.voidsetShowPivotTableFieldList(boolean value) Sets a value indicating whether the PivotTable field list can be shown.voidSets the theme applied to the current workbook.toJson()Generates a json string from a workbook.toJson(SerializationOptions serializationOptions) Generates a json string from the workbook.voidtoJson(OutputStream stream) Generates a json stream from a workbook.voidtoJson(OutputStream stream, SerializationOptions serializationOptions) Generates a json stream from a workbook.Generates a JSON string from a workbook.toSjsJson(SjsSaveOptions options) Generates a JSON string from a workbook.voidtoSjsJson(OutputStream stream) Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream.voidtoSjsJson(OutputStream stream, SjsSaveOptions options) Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream.voidRemoves protection from the workbook.voidRemoves protection from the workbook.voidupdateExcelLink(String name) Updates a excel link.voidupdateExcelLink(String name, IWorkbook sourceWorkbook) Updates a excel link.voidUpdates all the excel links.voidWaits for all calculation to complete, including asynchronous calculations.
-
Method Details
-
getAfterSaveEvent
Event<EventHandler<EventArgs>> getAfterSaveEvent()Occurs after the workbook is saved. -
getBeforeSaveEvent
Event<EventHandler<EventArgs>> getBeforeSaveEvent()Occurs before the workbook is saved. -
getNewSheetEvent
Event<EventHandler<SheetEventArgs>> getNewSheetEvent()Occurs when a new sheet is created in the workbook. -
getOpenedEvent
Event<EventHandler<EventArgs>> getOpenedEvent()Occurs when the workbook is opened. -
getSheetActivateEvent
Event<EventHandler<SheetEventArgs>> getSheetActivateEvent()Occurs when a sheet is activate. -
getSheetBeforeDeleteEvent
Event<EventHandler<SheetEventArgs>> getSheetBeforeDeleteEvent()Occurs before a sheet is deleted. -
getSheetChangeEvent
Event<EventHandler<RangeEventArgs>> getSheetChangeEvent()Occurs when something changes in the cells of a sheet. -
getSheetDeactivateEvent
Event<EventHandler<SheetEventArgs>> getSheetDeactivateEvent()Occurs when a sheet is deactivated. -
getSheetSelectionChange
Event<EventHandler<RangeEventArgs>> getSheetSelectionChange()Occurs when the selection changes on a sheet. -
getAllowDynamicArray
Deprecated.This method is obsoleted, please useIRange.getFormula2()to get dynamic array formula.Gets whether allow dynamic array formula. -
setAllowDynamicArray
Deprecated.method is obsoleted, please useIRange.setFormula2(String)to set dynamic array formula.Sets whether allow dynamic array formula. -
getDeferUpdateDirtyState
boolean getDeferUpdateDirtyState()Gets whether update the dirty state of the formula cells immediately when changing the value of a cell. -
setDeferUpdateDirtyState
void setDeferUpdateDirtyState(boolean value) Sets whether update the dirty state of the formula cells immediately when changing the value of a cell. -
getName
String getName()Gets a string value that represents the name of the workbook. -
setName
Sets a string value that represents the name of the workbook. -
getFullName
String getFullName()Returns the name of the workbook, including its path on disk. -
getPath
String getPath()Gets a string that represents the path to the workbook file that this workbook object represents. -
setPath
Sets a string that represents the path to the workbook file that this workbook object represents. -
getSelectedSheets
IWorksheets getSelectedSheets()Returns aIWorksheetscollectionthat represents all the selected sheets in the specified workbook. -
getOptions
IExcelOptions getOptions()Returns theIExcelOptionsobject that represents some settings to control workbook behavior. -
getResetAdjacentRangeBorder
boolean getResetAdjacentRangeBorder()Determines whether to reset adjacent range's border when setting border for a range. The default value of this property is true. -
setResetAdjacentRangeBorder
void setResetAdjacentRangeBorder(boolean value) Determines whether to reset adjacent range's border when setting border for a range. The default value of this property is true.- Parameters:
value- True to reset the border of adjacent ranges, false otherwise.
-
getAutoParse
boolean getAutoParse()Gets whether to automatically parse when setting a range value to a string value. -
setAutoParse
void setAutoParse(boolean value) Sets whether to automatically parse when setting a range value to a string value. -
getAutoRoundValue
boolean getAutoRoundValue()Gets whether to round the number to 15 significant figures when getting the value. -
setAutoRoundValue
void setAutoRoundValue(boolean value) Sets whether to round the number to 15 significant figures when getting the value. -
getBookView
IWorkbookView getBookView()Returns an object that represents the view settings of this workbook. -
getProtectStructure
boolean getProtectStructure()True if the order of the sheets in the workbook is protected. Read-only Boolean. -
getProtectWindows
boolean getProtectWindows()True if the windows of the workbook are protected. Read-only Boolean. -
getSignatures
ISignatureSet getSignatures()Gets a collection of Signature objects that correspond to the digital signature attached to a document. -
getBuiltInDocumentProperties
IBuiltInDocumentPropertyCollection getBuiltInDocumentProperties()Gets a collection that represents all the built-in document properties of the workbook. -
getCustomDocumentProperties
ICustomDocumentPropertyCollection getCustomDocumentProperties()Gets a collection that represents all the custom document properties of the workbook. -
getCustomViews
ICustomViews getCustomViews()Gets the custom views of the workbook. -
getWriteProtection
WriteProtection getWriteProtection()Returns aWriteProtectionobject that provides access to the workbook write protection options. -
getEnableCalculation
boolean getEnableCalculation()Gets whether the calculation engine is valid. -
setEnableCalculation
void setEnableCalculation(boolean value) Sets whether the calculation engine is valid. -
getCulture
Locale getCulture()Gets culture info for the workbook. Which influences the feature related culture. -
setCulture
Sets culture info for the workbook. Which influences the feature related culture.The culture must contain both country/region and language. For example:
- API Note:
- The culture is init-only. It must be set in the initialization code of the workbook instance.
-
getDefaultTableStyle
String getDefaultTableStyle()Gets the table style name from theITableStyleCollectioncollectionthat is used as the default TableStyle. -
setDefaultTableStyle
Sets the table style name from theITableStyleCollectioncollectionthat is used as the default TableStyle. -
getNames
INames getNames()Returns theINamescollection that represents the workbook-specified names. -
getAuthor
String getAuthor()Gets the author. -
setAuthor
Sets the author. -
getPivotCaches
IPivotCaches getPivotCaches()Returns theIPivotCachescollection that represents all theIPivotTablecaches in the specified workbook. -
getReferenceStyle
ReferenceStyle getReferenceStyle()Gets the reference style. -
setReferenceStyle
Sets the reference style. -
getStyles
IStyleCollection getStyles()Returns theIStyleCollectioncollection that represents all thestyles in the specified workbook. -
getTableStyles
ITableStyleCollection getTableStyles()Returns theITableStyleCollectioncollection object for the currentworkbook that refers to the styles used in the current workbook. -
getTheme
ITheme getTheme()Returns the theme applied to the current workbook. -
setTheme
Sets the theme applied to the current workbook. -
getIconSets
IIconSets getIconSets()Filters data in a workbook based on a cell icon from the IconSets collection. -
getWorksheets
IWorksheets getWorksheets()Returns theIWorksheetscollection that represents all the worksheetsin the specified workbook. This is a read-only Sheets object. -
getActiveSheet
IWorksheet getActiveSheet()Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns null if no sheet is active. -
getSlicerCaches
ISlicerCaches getSlicerCaches()Gets theISlicerCachesobject associated with the workbook. -
calculate
void calculate()Calculates formulas of the workbook as needed. -
dirty
void dirty()Designates all the formulas of the workbook to be recalculated when the next calculation occurs. -
fromJson
Generates a workbook from a json string.- Parameters:
json- the json.- Returns:
- the errors in the json.
-
fromJson
Generates a workbook from a json string.- Parameters:
json- the json.deserializationOptions- theDeserializationOptionsobject.- Returns:
- the errors in the json.
-
fromJson
Generates a workbook from a json stream.- Parameters:
stream- the stream- Returns:
- the errors in the json.
-
fromJson
Generates a workbook from a json stream.- Parameters:
stream- the streamdeserializationOptions- theDeserializationOptionsobject.- Returns:
- the errors in the json.
-
toJson
String toJson()Generates a json string from a workbook.- Returns:
- the json string.
-
toJson
Generates a json string from the workbook.- Parameters:
serializationOptions- theSerializationOptionsobject.- Returns:
- The json string
-
toJson
Generates a json stream from a workbook.- Parameters:
stream- the output stream.
-
toJson
Generates a json stream from a workbook.- Parameters:
stream- the output stream.serializationOptions- theSerializationOptionsobject.
-
isEncryptedFile
Specifies whether the file is password protected.- Parameters:
fileName- the file name.
-
isEncryptedFile
Specifies whether the file is password protected.- Parameters:
fileStream- the input file stream.
-
open
Opens the specified excel file- Parameters:
fileName- The excel file.
-
open
Opens the json file.- Parameters:
fileName- The specified json file.deserializationOptions- The json deserialization options.- Returns:
- Json errors
-
open
Opens the specified excel file- Parameters:
fileName- The excel file.password- The password of the file.
-
open
Opens the file with specified options.- Parameters:
fileName- The excel file.options- The options of opening the file. Possible types:
-
open
Opens the specified format file.- Parameters:
fileName- The specified file.fileFormat- The format of the file.
-
open
Opens the specified excel file stream.- Parameters:
fileStream- The file stream.
-
open
Opens the specified excel file stream.- Parameters:
fileStream- The file stream.password- The password of the file.
-
open
Opens the stream with specified options.- Parameters:
fileStream- The file stream.options- The format of opening the file stream. Possible types:
-
open
Opens the specified format file stream.- Parameters:
fileStream- The specified file stream.fileFormat- The format of the file stream.
-
save
Saves the workbook to the disk.- Parameters:
fileName- The file name.
-
save
Saves data to the specified excel file.- Parameters:
fileName- The excel file.password- The password of the file.
-
save
Saves workbook to file with specified options.- Parameters:
fileName- The specified file.options- The options of saving the file. Possible types:
-
save
Saves the specified format file.- Parameters:
fileName- The specified file.fileFormat- The format of the file.
-
save
Saves the workbook to the stream.- Parameters:
outputStream- The file stream.
-
save
Saves data to the specified excel file stream.- Parameters:
outputStream- The file stream.password- The password of the file.
-
save
Saves workbook to stream with specified options.- Parameters:
fileStream- The specified file stream.options- The options of saving the file stream. Possible types:
-
save
Saves the specified format file stream.- Parameters:
fileStream- The specified file stream.fileFormat- The format of the file stream.
-
getUsedFonts
Gets all fonts information that used on workbook. -
protect
void protect()Protects a workbook so that it cannot be modified. -
protect
void protect(boolean structure) Protects a workbook so that it cannot be modified.- Parameters:
structure- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).
-
protect
void protect(boolean structure, boolean windows) Protects a workbook so that it cannot be modified.- Parameters:
structure- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).windows- True to prevent users from moving, resizing, or closing the workbook window, or hide/unhide windows. This option is available only in Excel 2007, Excel 2010, Excel for Mac 2011, and Excel 2016 for Mac.
-
protect
Protects a workbook so that it cannot be modified.- Parameters:
password- Password to protect the workbook.
-
protect
Protects a workbook so that it cannot be modified.- Parameters:
password- Password to protect the workbook.structure- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).
-
protect
Protects a workbook so that it cannot be modified.- Parameters:
password- Password to protect the workbook.structure- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).windows- True to prevent users from moving, resizing, or closing the workbook window, or hide/unhide windows. This option is available only in Excel 2007, Excel 2010, Excel for Mac 2011, and Excel 2016 for Mac.
-
unprotect
void unprotect()Removes protection from the workbook. -
unprotect
Removes protection from the workbook.- Parameters:
password- Password to protect the workbook.
-
addDataSource
Add data source for template.- Parameters:
name- : the alias name of the data source.dataSource- : Can be object of ResultSet, Custom object and variable.
-
processTemplate
void processTemplate()Start to process the template. -
processTemplate
Start to process the template with global options and cancellation support.- Parameters:
cancellationToken- The token to monitor for cancellation requests.- Throws:
CancellationException- Throws when theCancellationTokenwas canceled.- API Note:
- The caller must decide whether to accept the partially expanded template or revert to the previous state. If the caller needs to revert to the previous state, it must serialize the workbook before calling this method, then deserialize the workbook after canceling the operation.
-
generateReport
IWorkbook generateReport()Process the template and return the instance of report workbook.- Returns:
- The new
IWorkbookobject.
-
generateReport
Process the template and return the instance of report workbook.- Parameters:
worksheets- IWorksheet collection that need to be processed.- Returns:
- The new
IWorkbookobject.
-
getGraphicsInfo
IGraphicsInfo getGraphicsInfo()Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information. -
setGraphicsInfo
Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information. -
getExcelLinkSources
Returns the names of the linked excel documents. -
updateExcelLink
Updates a excel link. -
updateExcelLink
Updates a excel link. -
updateExcelLinks
void updateExcelLinks()Updates all the excel links. -
toSjsJson
String toSjsJson()Generates a JSON string from a workbook. It integrates all JSON files from the SpreadJS .sjs file into a single string.- Returns:
- Json data.
-
toSjsJson
Generates a JSON string from a workbook. It integrates all JSON files from the SpreadJS .sjs file into a single string.- Parameters:
options- Option for opening SpreadJS .sjs file.- Returns:
- Json data.
-
toSjsJson
Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream.- Parameters:
stream- The specified file stream.options- Option for opening SpreadJS .sjs file.
-
toSjsJson
Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream.- Parameters:
stream- The specified file stream.
-
convertBarcodeToPicture
void convertBarcodeToPicture()Convert the calculated barcodes to pictures and place them in their respective positions.
The original barcode formulas will be cleared.
TheImageTypeof converted image isImageType.SVG. -
convertBarcodeToPicture
Convert the calculated barcodes to pictures of pictures and place them in their respective positions.
The original barcode formulas will be cleared.
Not supportImageType.EMFandImageType.WMFimage types.- Parameters:
imageType- Specify theImageTypeof converted image.- Throws:
UnsupportedOperationException- If convert toImageType.EMForImageType.WMFimage type.
-
fromSjsJson
Generates a workbook from a JSON string containing the contents of .sjs file format.- Parameters:
json- The JSON string.
-
fromSjsJson
Generates a workbook from a JSON string containing the contents of .sjs file format.- Parameters:
json- The JSON string.openOptions- The open options for opening SpreadJS .sjs file.
-
fromSjsJson
Generates a workbook from a JSON stream containing the contents of .sjs file format.- Parameters:
stream- The JSON stream.openOptions- The open options for opening SpreadJS .sjs file.
-
fromSjsJson
Generates a workbook from a JSON stream containing the contents of .sjs file format.- Parameters:
stream- The JSON stream.
-
waitForCalculationToFinish
void waitForCalculationToFinish()Waits for all calculation to complete, including asynchronous calculations. This method blocks the current thread until all calculations have finished. Users can call this method to ensure that all necessary computations have been performed before proceeding with any other operations that depend on the calculation results. -
getShowPivotTableFieldList
boolean getShowPivotTableFieldList()Gets a value indicating whether the PivotTable field list can be shown. Default is true. -
setShowPivotTableFieldList
void setShowPivotTableFieldList(boolean value) Sets a value indicating whether the PivotTable field list can be shown.
-
IRange.getFormula2()to get dynamic array formula.