Package com.grapecity.documents.excel
Class Workbook
java.lang.Object
com.grapecity.documents.excel.Workbook
- All Implemented Interfaces:
IWorkbook
Represents a workbook.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic IFontProviderGets or sets the font provider that will be used when using Auto fit, PDF export, and Image export.static StringGets or sets the location of font files that will be used when exporting pdf. -
Constructor Summary
ConstructorsConstructorDescriptionWorkbook()Creates the workbook.Workbook(WorkbookOptions options) Creates the workbook.Creates a workbook and apply the specified license.Workbook(String licenseKey, WorkbookOptions options) Creates a workbook and apply the specified license. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdd custom function into the function set.static voidAddCustomFunction(CustomFunction func, boolean canOverride) Add custom function into the function set.voidaddDataSource(String name, Object dataSource) Add data source for template.voidCalculates formulas in 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 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 the JSON stream.fromJson(InputStream stream, DeserializationOptions deserializationOptions) Generates a workbook from a JSON stream.Generates a workbook from the 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.Gets the active sheet.Occurs after the workbook is saved.booleanDeprecated.Gets the author.booleanDetermines whether to parse automatically when setting range value to string value.booleanDetermines 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 the culture info of workbook, default is Locale.getDefault().Gets a collection that represents all the custom document properties of the workbook.Gets a collection that represents all the custom document properties of the workbook.Specifies the table style that is used as the default TableStyle.booleanGets whether update the dirty state of the formula cells immediately when changing the value of a cell.booleanSpecifies whether the calculation engine is working.Returns the names of the linked excel documents.Returns the name of the workbook, including its path on disk.final IGraphicsInfoProvides 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.static String[]getNames(InputStream fileStream) Gets all sheet names and tables names that will be used as the parameter source of ImportData.
If the name is a table name, the worksheet name is qualified before the table name, such as "Sheet1!Table1".static String[]Gets all sheet names and tables names that will be used as the parameter source of ImportData.
If the name is a table name, the worksheet name is qualified before the table name, such as "Sheet1!Table1".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.Gets a PivotCaches collection that represents all the PivotTable caches 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.final IWorksheetsReturns a IWorksheets collection that represents all the selected sheets in the specified workbook.Occurs when a sheet is active.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.Provides access to the collection of cell styles in the current workbook.Gets the table styles used in the current workbook.static IJsonSerializerGets JSON serializer for custom typegetTheme()Returns an instance of ITheme which provides access to the theme associated with a workbook.Gets all fonts information that are used on workbook.static IJsonSerializerGets JSON serializer for custom typestatic IWebRequestHandlerGets the singleton instance of the IWebRequestHandler implementation that will be used to handle web requests.Gets a collection of worksheets contained in the workbook.Provides access to the workbook write protection options.static Object[][]importData(InputStream fileStream, String sourceName) Import all the data of the specified source of the file.static Object[][]importData(InputStream fileStream, String worksheetName, int row, int column, int rowCount, int columnCount) Import the data of a specified range from a fileStream.static Object[][]importData(String fileName, String sourceName) Import all the data of the specified source of the file.static Object[][]importData(String fileName, String worksheetName, int row, int column, int rowCount, int columnCount) Import the data of a specified range from a file.booleanisEncryptedFile(InputStream fileStream) Specifies whether the file is password protected.booleanisEncryptedFile(String fileName) Specifies whether the file is password protected.final voidopen(InputStream fileStream) Opens the specified excel file stream.voidopen(InputStream fileStream, OpenFileFormat fileFormat) Opens the stream with specified file format.voidopen(InputStream fileStream, OpenOptionsBase options) Opens the stream with specified options.voidopen(InputStream fileStream, String password) Deprecated.Useopen(InputStream,OpenOptionsBase)insteadvoidOpens the file with default options.open(String fileName, DeserializationOptions deserializationOptions) Opens the JSON file.voidopen(String fileName, OpenFileFormat fileFormat) Opens the file with specified file format.voidopen(String fileName, OpenOptionsBase options) Opens the file with specified options.voidDeprecated.Useopen(String,OpenOptionsBase)insteadvoidStart 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 workbook to stream with specified file format.voidsave(OutputStream fileStream, SaveOptionsBase options) Saves workbook to stream with specified options.voidsave(OutputStream outputStream, String password) Deprecated.Usesave(OutputStream,SaveOptionsBase)insteadvoidSaves the workbook to the disk.voidsave(String fileName, SaveFileFormat fileFormat) Saves workbook to file with specified file format.voidsave(String fileName, SaveOptionsBase options) Saves workbook to file with specified options.voidDeprecated.Usesave(String,SaveOptionsBase)insteadvoidsetAllowDynamicArray(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.final voidsetGraphicsInfo(IGraphicsInfo value) Provides graphics information.static voidSetLicenseFile(String licenseFilePath) For licenses of the Chinese market, apply deployment license or unlimited dev license from file.static voidSetLicenseKey(String key) Sets license for all workbook instances.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.static voidSets JSON serializer for custom type in from/to JSON.voidSets the theme applied to the current workbook.static voidSets JSON serializer for custom type in from/to JSON.static voidsetWebRequestHandler(IWebRequestHandler webRequestHandler) Sets the singleton instance of the IWebRequestHandler implementation that will be used to handle web requests.toJson()Generates a JSON string from the workbook.toJson(SerializationOptions serializationOptions) Generates a JSON string from the workbook.voidtoJson(OutputStream stream) Generates a zipped JSON string from the 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.
-
Field Details
-
FontsFolderPath
Gets or sets the location of font files that will be used when exporting pdf. -
FontProvider
Gets or sets the font provider that will be used when using Auto fit, PDF export, and Image export.
-
-
Constructor Details
-
Workbook
public Workbook()Creates the workbook. -
Workbook
Creates the workbook.- Parameters:
options- The workbook options.
-
Workbook
Creates a workbook and apply the specified license.Important: For licenses of the Chinese market, use
SetLicenseFileorset license in theGCEXCEL_JAVA_DEPLOY_LICENSE_V7environment variable instead.- Parameters:
licenseKey- license key
-
Workbook
Creates a workbook and apply the specified license.Important: For licenses of the Chinese market, use
SetLicenseFileorset license in theGCEXCEL_JAVA_DEPLOY_LICENSE_V7environment variable instead.- Parameters:
licenseKey- license key.options- The workbook options.
-
-
Method Details
-
getAllowDynamicArray
Deprecated.method is obsoleted, please useIRange.getFormula2()to get dynamic array formula.Gets whether allow dynamic array formula.- Specified by:
getAllowDynamicArrayin interfaceIWorkbook
-
setAllowDynamicArray
Deprecated.method is obsoleted, please useIRange.setFormula2(String)to set dynamic array formula.Sets whether allow dynamic array formula.- Specified by:
setAllowDynamicArrayin interfaceIWorkbook
-
getDeferUpdateDirtyState
public boolean getDeferUpdateDirtyState()Gets whether update the dirty state of the formula cells immediately when changing the value of a cell.- Specified by:
getDeferUpdateDirtyStatein interfaceIWorkbook
-
setDeferUpdateDirtyState
public void setDeferUpdateDirtyState(boolean value) Sets whether update the dirty state of the formula cells immediately when changing the value of a cell.- Specified by:
setDeferUpdateDirtyStatein interfaceIWorkbook
-
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
Returns the name of the workbook, including its path on disk.- Specified by:
getFullNamein interfaceIWorkbook
-
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. -
open
Opens the file with default options. The file type is inferred from file extension. -
open
Opens the JSON file. -
open
Deprecated.Useopen(String,OpenOptionsBase)insteadOpens the specified excel file -
open
Opens the file with specified file format. -
open
Opens the file with specified options. -
open
Opens the specified excel file stream. -
open
Deprecated.Useopen(InputStream,OpenOptionsBase)insteadOpens the specified excel file stream. -
open
Opens the stream with specified file format. -
open
Opens the stream with specified options. -
save
Saves the workbook to the disk. -
save
Deprecated.Usesave(String,SaveOptionsBase)insteadSaves data to the specified excel file. -
save
Saves workbook to file with specified options. -
save
Saves workbook to file with specified file format. -
save
Saves the workbook to the stream. -
save
Deprecated.Usesave(OutputStream,SaveOptionsBase)insteadSaves data to the specified excel file stream. -
save
Saves workbook to stream with specified options. -
save
Saves workbook to stream with specified file format. -
getAfterSaveEvent
Occurs after the workbook is saved.- Specified by:
getAfterSaveEventin interfaceIWorkbook
-
getBeforeSaveEvent
Occurs before the workbook is saved.- Specified by:
getBeforeSaveEventin interfaceIWorkbook
-
getNewSheetEvent
Occurs when a new sheet is created in the workbook.- Specified by:
getNewSheetEventin interfaceIWorkbook
-
getOpenedEvent
Occurs when the workbook is opened.- Specified by:
getOpenedEventin interfaceIWorkbook
-
getSheetActivateEvent
Occurs when a sheet is active.- Specified by:
getSheetActivateEventin interfaceIWorkbook
-
getSheetBeforeDeleteEvent
Occurs before a sheet is deleted.- Specified by:
getSheetBeforeDeleteEventin interfaceIWorkbook
-
getSheetChangeEvent
Occurs when something changes in the cells of a sheet.- Specified by:
getSheetChangeEventin interfaceIWorkbook
-
getSheetDeactivateEvent
Occurs when a sheet is deactivated.- Specified by:
getSheetDeactivateEventin interfaceIWorkbook
-
getSheetSelectionChange
Occurs when the selection changes on a sheet.- Specified by:
getSheetSelectionChangein interfaceIWorkbook
-
getOptions
Returns theIExcelOptionsobject that represents some settings to control workbook behavior.- Specified by:
getOptionsin interfaceIWorkbook
-
getBuiltInDocumentProperties
Gets a collection that represents all the built-in document properties of the workbook.- Specified by:
getBuiltInDocumentPropertiesin interfaceIWorkbook
-
getCustomDocumentProperties
Gets a collection that represents all the custom document properties of the workbook.- Specified by:
getCustomDocumentPropertiesin interfaceIWorkbook
-
getCustomViews
Gets a collection that represents all the custom document properties of the workbook.- Specified by:
getCustomViewsin interfaceIWorkbook
-
getWriteProtection
Provides access to the workbook write protection options.- Specified by:
getWriteProtectionin interfaceIWorkbook
-
getSignatures
Gets a collection of Signature objects that correspond to the digital signature attached to a document.- Specified by:
getSignaturesin interfaceIWorkbook
-
getTagJsonSerializer
Gets JSON serializer for custom type- Returns:
- The JSON serializer for tag custom type.
-
setTagJsonSerializer
Sets JSON serializer for custom type in from/to JSON.- Parameters:
value- The JSON serializer for tag custom type.
-
getValueJsonSerializer
Gets JSON serializer for custom type- Returns:
- The JSON serializer for custom type.
-
setValueJsonSerializer
Sets JSON serializer for custom type in from/to JSON.- Parameters:
value- The JSON serializer for custom type.
-
getAutoParse
public boolean getAutoParse()Determines whether to parse automatically when setting range value to string value.- Specified by:
getAutoParsein interfaceIWorkbook
-
setAutoParse
public void setAutoParse(boolean value) Sets whether to automatically parse when setting a range value to a string value.- Specified by:
setAutoParsein interfaceIWorkbook
-
getAutoRoundValue
public boolean getAutoRoundValue()Determines whether to round the number to 15 significant figures when getting the value.- Specified by:
getAutoRoundValuein interfaceIWorkbook
-
setAutoRoundValue
public void setAutoRoundValue(boolean value) Sets whether to round the number to 15 significant figures when getting the value.- Specified by:
setAutoRoundValuein interfaceIWorkbook
-
getBookView
Returns an object that represents the view settings of this workbook.- Specified by:
getBookViewin interfaceIWorkbook
-
getProtectStructure
public boolean getProtectStructure()True if the order of the sheets in the workbook is protected. Read-only Boolean.- Specified by:
getProtectStructurein interfaceIWorkbook
-
getProtectWindows
public boolean getProtectWindows()True if the windows of the workbook are protected. Read-only Boolean.- Specified by:
getProtectWindowsin interfaceIWorkbook
-
getReferenceStyle
Gets the reference style.- Specified by:
getReferenceStylein interfaceIWorkbook
-
setReferenceStyle
Sets the reference style.- Specified by:
setReferenceStylein interfaceIWorkbook
-
getWorksheets
Gets a collection of worksheets contained in the workbook.- Specified by:
getWorksheetsin interfaceIWorkbook
-
getActiveSheet
Gets the active sheet.- Specified by:
getActiveSheetin interfaceIWorkbook
-
getTheme
Returns an instance of ITheme which provides access to the theme associated with a workbook. -
setTheme
Sets the theme applied to the current workbook. -
getIconSets
Filters data in a workbook based on a cell icon from the IconSets collection.- Specified by:
getIconSetsin interfaceIWorkbook
-
getDefaultTableStyle
Specifies the table style that is used as the default TableStyle.- Specified by:
getDefaultTableStylein interfaceIWorkbook
-
setDefaultTableStyle
Sets the table style name from theITableStyleCollectioncollectionthat is used as the default TableStyle.- Specified by:
setDefaultTableStylein interfaceIWorkbook
-
getCulture
Gets the culture info of workbook, default is Locale.getDefault().- Specified by:
getCulturein interfaceIWorkbook
-
setCulture
Sets culture info for the workbook. Which influences the feature related culture.The culture must contain both country/region and language. For example:
- Specified by:
setCulturein interfaceIWorkbook- API Note:
- The culture is init-only. It must be set in the initialization code of the workbook instance.
-
getEnableCalculation
public boolean getEnableCalculation()Specifies whether the calculation engine is working.- Specified by:
getEnableCalculationin interfaceIWorkbook
-
setEnableCalculation
public void setEnableCalculation(boolean value) Sets whether the calculation engine is valid.- Specified by:
setEnableCalculationin interfaceIWorkbook
-
AddCustomFunction
Add custom function into the function set.- Parameters:
func- the custom function instance.
-
AddCustomFunction
Add custom function into the function set.- Parameters:
func- the custom function instance.canOverride- override the exist function.
-
getPivotCaches
Gets a PivotCaches collection that represents all the PivotTable caches in the specified workbook.- Specified by:
getPivotCachesin interfaceIWorkbook
-
getSlicerCaches
Gets theISlicerCachesobject associated with the workbook.- Specified by:
getSlicerCachesin interfaceIWorkbook
-
getUsedFonts
Gets all fonts information that are used on workbook.- Specified by:
getUsedFontsin interfaceIWorkbook
-
calculate
public void calculate()Calculates formulas in the workbook as needed. -
dirty
public void dirty()Designates all the formulas of the workbook to be recalculated when the next calculation occurs. -
getStyles
Provides access to the collection of cell styles in the current workbook. -
getTableStyles
Gets the table styles used in the current workbook.- Specified by:
getTableStylesin interfaceIWorkbook
-
getNames
Returns theINamescollection that represents the workbook-specified names. -
getAuthor
Gets the author. -
setAuthor
Sets the author. -
isEncryptedFile
Specifies whether the file is password protected.- Specified by:
isEncryptedFilein interfaceIWorkbook- Parameters:
fileName- The file name.
-
isEncryptedFile
Specifies whether the file is password protected.- Specified by:
isEncryptedFilein interfaceIWorkbook- Parameters:
fileStream- The file stream.
-
toJson
Generates a JSON string from the workbook. -
toJson
Generates a JSON string from the workbook.- Specified by:
toJsonin interfaceIWorkbook- Parameters:
serializationOptions- theSerializationOptionsobject.- Returns:
- The JSON string
-
toJson
Generates a zipped JSON string from the workbook. -
toJson
Generates a JSON stream from a workbook.- Specified by:
toJsonin interfaceIWorkbook- Parameters:
stream- the output stream.serializationOptions- theSerializationOptionsobject.
-
fromJson
Generates a workbook from the JSON string. -
fromJson
Generates a workbook from a JSON string.- Specified by:
fromJsonin interfaceIWorkbook- Parameters:
json- the JSON.deserializationOptions- theDeserializationOptionsobject.- Returns:
- the errors in the JSON.
-
fromJson
Generates a workbook from the JSON stream. -
fromJson
Generates a workbook from a JSON stream.- Specified by:
fromJsonin interfaceIWorkbook- Parameters:
stream- the streamdeserializationOptions- theDeserializationOptionsobject.- Returns:
- the errors in the JSON.
-
fromSjsJson
Generates a workbook from a JSON string containing the contents of .sjs file format.- Specified by:
fromSjsJsonin interfaceIWorkbook- Parameters:
json- The JSON string.
-
fromSjsJson
Generates a workbook from a JSON string containing the contents of .sjs file format.- Specified by:
fromSjsJsonin interfaceIWorkbook- 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.- Specified by:
fromSjsJsonin interfaceIWorkbook- Parameters:
stream- The JSON stream.
-
waitForCalculationToFinish
public 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.- Specified by:
waitForCalculationToFinishin interfaceIWorkbook
-
getWebRequestHandler
Gets the singleton instance of the IWebRequestHandler implementation that will be used to handle web requests. This property provides a centralized way to access the web request handler for the application.- Returns:
- the singleton instance of IWebRequestHandler
-
setWebRequestHandler
Sets the singleton instance of the IWebRequestHandler implementation that will be used to handle web requests. This property provides a centralized way to set the web request handler for the application.- Parameters:
webRequestHandler- the new singleton instance of IWebRequestHandler
-
fromSjsJson
Generates a workbook from a JSON stream containing the contents of .sjs file format.- Specified by:
fromSjsJsonin interfaceIWorkbook- Parameters:
stream- The JSON stream.openOptions- The open options for opening SpreadJS .sjs file.
-
protect
public void protect()Protects a workbook so that it cannot be modified. -
protect
public void protect(boolean structure) Protects a workbook so that it cannot be modified. -
protect
public void protect(boolean structure, boolean windows) Protects a workbook so that it cannot be modified.- Specified by:
protectin interfaceIWorkbook- Parameters:
structure- True to protect the structure of the workbook (To prevent otherusers from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).windows- True to prevent users from moving, resizing, or closing theworkbook 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. -
protect
Protects a workbook so that it cannot be modified. -
protect
Protects a workbook so that it cannot be modified.- Specified by:
protectin interfaceIWorkbook- 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
public void unprotect()Removes protection from the workbook. -
unprotect
Removes protection from the workbook. -
addDataSource
Add data source for template.- Specified by:
addDataSourcein interfaceIWorkbook- Parameters:
name- : the alias name of the data source.dataSource- : Can be object of ResultSet, Custom object and variable.
-
processTemplate
public void processTemplate()Start to process the template.- Specified by:
processTemplatein interfaceIWorkbook
-
processTemplate
Start to process the template with global options and cancellation support.- Specified by:
processTemplatein interfaceIWorkbook- 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
Process the template and return the instance of report workbook.- Specified by:
generateReportin interfaceIWorkbook- Returns:
- The new
IWorkbookobject.
-
generateReport
Process the template and return the instance of report workbook.- Specified by:
generateReportin interfaceIWorkbook- Parameters:
worksheets- IWorksheet collection that need to be processed.- Returns:
- The new
IWorkbookobject.
-
getResetAdjacentRangeBorder
public boolean getResetAdjacentRangeBorder()Determines whether to reset adjacent range's border when setting border for a range. The default value of this property is true.- Specified by:
getResetAdjacentRangeBorderin interfaceIWorkbook
-
setResetAdjacentRangeBorder
public 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.- Specified by:
setResetAdjacentRangeBorderin interfaceIWorkbook- Parameters:
value- True to reset the border of adjacent ranges, false otherwise.
-
SetLicenseKey
Sets license for all workbook instances.Important: For licenses of the Chinese market, use
SetLicenseFileorset license in theGCEXCEL_JAVA_DEPLOY_LICENSE_V7environment variable instead.- Parameters:
key- The license key.
-
SetLicenseFile
For licenses of the Chinese market, apply deployment license or unlimited dev license from file.This method shouldn't be called if your license was purchased from other markets.
- Parameters:
licenseFilePath- The file that contains license key
-
getGraphicsInfo
Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information.- Specified by:
getGraphicsInfoin interfaceIWorkbook
-
setGraphicsInfo
Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information.- Specified by:
setGraphicsInfoin interfaceIWorkbook
-
getSelectedSheets
Returns a IWorksheets collection that represents all the selected sheets in the specified workbook.- Specified by:
getSelectedSheetsin interfaceIWorkbook
-
getExcelLinkSources
Returns the names of the linked excel documents.- Specified by:
getExcelLinkSourcesin interfaceIWorkbook
-
updateExcelLinks
public void updateExcelLinks()Updates all the excel links.- Specified by:
updateExcelLinksin interfaceIWorkbook
-
updateExcelLink
Updates a excel link.- Specified by:
updateExcelLinkin interfaceIWorkbook
-
updateExcelLink
Updates a excel link.- Specified by:
updateExcelLinkin interfaceIWorkbook
-
getNames
Gets all sheet names and tables names that will be used as the parameter source of ImportData.
If the name is a table name, the worksheet name is qualified before the table name, such as "Sheet1!Table1".- Parameters:
fileName- The path and name for the file.- Returns:
- An array of possible import names.
-
getNames
Gets all sheet names and tables names that will be used as the parameter source of ImportData.
If the name is a table name, the worksheet name is qualified before the table name, such as "Sheet1!Table1".- Parameters:
fileStream- The fileStream of a workbook.- Returns:
- An array of possible import names.
-
importData
Import all the data of the specified source of the file.- Parameters:
fileName- The path and name for the file.sourceName- The name of the source data. The source name could be:
worksheet "Sheet1"
table "Sheet1!Table1"
range "Sheet1!A1:C5"- Returns:
- An array for the data.
-
importData
public static Object[][] importData(String fileName, String worksheetName, int row, int column, int rowCount, int columnCount) Import the data of a specified range from a file.- Parameters:
fileName- The path and name for the file.worksheetName- The name of the worksheet.row- The first row of the range.column- The first column of the range.rowCount- The count of the rows.columnCount- The count of the columns.
-
importData
Import all the data of the specified source of the file.- Parameters:
fileStream- The fileStream of a workbook.sourceName- The name of the source data. The source name could be:
worksheet "Sheet1"
table "Sheet1!Table1"
range "Sheet1!A1:C5"- Returns:
- An array for the data.
-
importData
public static Object[][] importData(InputStream fileStream, String worksheetName, int row, int column, int rowCount, int columnCount) Import the data of a specified range from a fileStream.- Parameters:
fileStream- The fileStream of a workbook.worksheetName- The name of the worksheet.row- The first row of the range.column- The first column of the range.rowCount- The count of the rows.columnCount- The count of the columns.
-
toSjsJson
Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream. -
toSjsJson
Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream. -
toSjsJson
Generates a JSON string from a workbook. It integrates all JSON files from the SpreadJS .sjs file into a single string. -
toSjsJson
Generates a JSON string from a workbook. It integrates all JSON files from the SpreadJS .sjs file into a single string. -
convertBarcodeToPicture
public 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.- Specified by:
convertBarcodeToPicturein interfaceIWorkbook
-
convertBarcodeToPicture
Convert the calculated barcodes to pictures and place them in their respective positions.
The original barcode formulas will be cleared.
Not supportImageType.EMFandImageType.WMFimage types.- Specified by:
convertBarcodeToPicturein interfaceIWorkbook- Parameters:
imageType- Specify theImageTypeof converted image.- Throws:
UnsupportedOperationException- If convert toImageType.EMForImageType.WMFimage type.
-
getShowPivotTableFieldList
public boolean getShowPivotTableFieldList()Gets a value indicating whether the PivotTable field list can be shown. Default is true.- Specified by:
getShowPivotTableFieldListin interfaceIWorkbook
-
setShowPivotTableFieldList
public void setShowPivotTableFieldList(boolean value) Sets a value indicating whether the PivotTable field list can be shown. Default is true.- Specified by:
setShowPivotTableFieldListin interfaceIWorkbook
-
IRange.getFormula2()to get dynamic array formula.