[]
        
(Showing Draft Content)

Workbook

Class Workbook

java.lang.Object
com.grapecity.documents.excel.Workbook
All Implemented Interfaces:
IWorkbook

public final class Workbook extends Object implements IWorkbook
Represents a workbook.
  • Field Details

    • FontsFolderPath

      public static String FontsFolderPath
      Gets or sets the location of font files that will be used when exporting pdf.
    • FontProvider

      public static IFontProvider 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

      public Workbook(WorkbookOptions options)
      Creates the workbook.
      Parameters:
      options - The workbook options.
    • Workbook

      public Workbook(String licenseKey)
      Creates a workbook and apply the specified license.

      Important: For licenses of the Chinese market, use SetLicenseFile orset license in the GCEXCEL_JAVA_DEPLOY_LICENSE_V7 environment variable instead.

      Parameters:
      licenseKey - license key
    • Workbook

      public Workbook(String licenseKey, WorkbookOptions options)
      Creates a workbook and apply the specified license.

      Important: For licenses of the Chinese market, use SetLicenseFile orset license in the GCEXCEL_JAVA_DEPLOY_LICENSE_V7 environment variable instead.

      Parameters:
      licenseKey - license key.
      options - The workbook options.
  • Method Details

    • getAllowDynamicArray

      @Deprecated public boolean getAllowDynamicArray()
      Deprecated.
      method is obsoleted, please use IRange.getFormula2() to get dynamic array formula.
      Gets whether allow dynamic array formula.
      Specified by:
      getAllowDynamicArray in interface IWorkbook
    • setAllowDynamicArray

      @Deprecated public void setAllowDynamicArray(boolean value)
      Deprecated.
      method is obsoleted, please use IRange.setFormula2(String) to set dynamic array formula.
      Sets whether allow dynamic array formula.
      Specified by:
      setAllowDynamicArray in interface IWorkbook
    • getDeferUpdateDirtyState

      public boolean getDeferUpdateDirtyState()
      Gets whether update the dirty state of the formula cells immediately when changing the value of a cell.
      Specified by:
      getDeferUpdateDirtyState in interface IWorkbook
    • 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:
      setDeferUpdateDirtyState in interface IWorkbook
    • getName

      public String getName()
      Gets a string value that represents the name of the workbook.
      Specified by:
      getName in interface IWorkbook
    • setName

      public void setName(String name)
      Sets a string value that represents the name of the workbook.
      Specified by:
      setName in interface IWorkbook
    • getFullName

      public String getFullName()
      Returns the name of the workbook, including its path on disk.
      Specified by:
      getFullName in interface IWorkbook
    • getPath

      public String getPath()
      Gets a string that represents the path to the workbook file that this workbook object represents.
      Specified by:
      getPath in interface IWorkbook
    • setPath

      public void setPath(String path)
      Sets a string that represents the path to the workbook file that this workbook object represents.
      Specified by:
      setPath in interface IWorkbook
    • open

      public void open(String fileName)
      Opens the file with default options. The file type is inferred from file extension.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileName - The specified file.
    • open

      public List<JsonError> open(String fileName, DeserializationOptions deserializationOptions)
      Opens the JSON file.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileName - The specified JSON file.
      deserializationOptions - The JSON deserialization options.
      Returns:
      Json errors
    • open

      @Deprecated public void open(String fileName, String password)
      Deprecated.
      Opens the specified excel file
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileName - The excel file.
      password - The password of the file.
    • open

      public void open(String fileName, OpenFileFormat fileFormat)
      Opens the file with specified file format.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileName - The specified file.
      fileFormat - The format of the file.
    • open

      public void open(String fileName, OpenOptionsBase options)
      Opens the file with specified options.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileName - The excel file.
      options - The options of opening the file. Possible types:
    • open

      public final void open(InputStream fileStream)
      Opens the specified excel file stream.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileStream - The file stream.
    • open

      @Deprecated public void open(InputStream fileStream, String password)
      Deprecated.
      Opens the specified excel file stream.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileStream - The file stream.
      password - The password of the file.
    • open

      public void open(InputStream fileStream, OpenFileFormat fileFormat)
      Opens the stream with specified file format.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileStream - The specified file stream.
      fileFormat - The format of the file stream.
    • open

      public void open(InputStream fileStream, OpenOptionsBase options)
      Opens the stream with specified options.
      Specified by:
      open in interface IWorkbook
      Parameters:
      fileStream - The file stream.
      options - The format of opening the file stream. Possible types:
    • save

      public void save(String fileName)
      Saves the workbook to the disk.
      Specified by:
      save in interface IWorkbook
      Parameters:
      fileName - The file name.
    • save

      @Deprecated public void save(String fileName, String password)
      Deprecated.
      Saves data to the specified excel file.
      Specified by:
      save in interface IWorkbook
      Parameters:
      fileName - The excel file.
      password - The password of the file.
    • save

      public void save(String fileName, SaveOptionsBase options)
      Saves workbook to file with specified options.
      Specified by:
      save in interface IWorkbook
      Parameters:
      fileName - The specified file.
      options - The options of saving the file. Possible types:
    • save

      public void save(String fileName, SaveFileFormat fileFormat)
      Saves workbook to file with specified file format.
      Specified by:
      save in interface IWorkbook
      Parameters:
      fileName - The specified file.
      fileFormat - The format of the file.
    • save

      public void save(OutputStream outputStream)
      Saves the workbook to the stream.
      Specified by:
      save in interface IWorkbook
      Parameters:
      outputStream - The file stream.
    • save

      @Deprecated public void save(OutputStream outputStream, String password)
      Deprecated.
      Saves data to the specified excel file stream.
      Specified by:
      save in interface IWorkbook
      Parameters:
      outputStream - The file stream.
      password - The password of the file.
    • save

      public void save(OutputStream fileStream, SaveOptionsBase options)
      Saves workbook to stream with specified options.
      Specified by:
      save in interface IWorkbook
      Parameters:
      fileStream - The specified file stream.
      options - The options of saving the file stream. Possible types:
    • save

      public void save(OutputStream fileStream, SaveFileFormat fileFormat)
      Saves workbook to stream with specified file format.
      Specified by:
      save in interface IWorkbook
      Parameters:
      fileStream - The specified file stream.
      fileFormat - The format of the file stream.
    • getAfterSaveEvent

      public Event<EventHandler<EventArgs>> getAfterSaveEvent()
      Occurs after the workbook is saved.
      Specified by:
      getAfterSaveEvent in interface IWorkbook
    • getBeforeSaveEvent

      public Event<EventHandler<EventArgs>> getBeforeSaveEvent()
      Occurs before the workbook is saved.
      Specified by:
      getBeforeSaveEvent in interface IWorkbook
    • getNewSheetEvent

      public Event<EventHandler<SheetEventArgs>> getNewSheetEvent()
      Occurs when a new sheet is created in the workbook.
      Specified by:
      getNewSheetEvent in interface IWorkbook
    • getOpenedEvent

      public Event<EventHandler<EventArgs>> getOpenedEvent()
      Occurs when the workbook is opened.
      Specified by:
      getOpenedEvent in interface IWorkbook
    • getSheetActivateEvent

      public Event<EventHandler<SheetEventArgs>> getSheetActivateEvent()
      Occurs when a sheet is active.
      Specified by:
      getSheetActivateEvent in interface IWorkbook
    • getSheetBeforeDeleteEvent

      public Event<EventHandler<SheetEventArgs>> getSheetBeforeDeleteEvent()
      Occurs before a sheet is deleted.
      Specified by:
      getSheetBeforeDeleteEvent in interface IWorkbook
    • getSheetChangeEvent

      public Event<EventHandler<RangeEventArgs>> getSheetChangeEvent()
      Occurs when something changes in the cells of a sheet.
      Specified by:
      getSheetChangeEvent in interface IWorkbook
    • getSheetDeactivateEvent

      public Event<EventHandler<SheetEventArgs>> getSheetDeactivateEvent()
      Occurs when a sheet is deactivated.
      Specified by:
      getSheetDeactivateEvent in interface IWorkbook
    • getSheetSelectionChange

      public Event<EventHandler<RangeEventArgs>> getSheetSelectionChange()
      Occurs when the selection changes on a sheet.
      Specified by:
      getSheetSelectionChange in interface IWorkbook
    • getOptions

      public IExcelOptions getOptions()
      Returns the IExcelOptions object that represents some settings to control workbook behavior.
      Specified by:
      getOptions in interface IWorkbook
    • getBuiltInDocumentProperties

      public IBuiltInDocumentPropertyCollection getBuiltInDocumentProperties()
      Gets a collection that represents all the built-in document properties of the workbook.
      Specified by:
      getBuiltInDocumentProperties in interface IWorkbook
    • getCustomDocumentProperties

      public ICustomDocumentPropertyCollection getCustomDocumentProperties()
      Gets a collection that represents all the custom document properties of the workbook.
      Specified by:
      getCustomDocumentProperties in interface IWorkbook
    • getCustomViews

      public ICustomViews getCustomViews()
      Gets a collection that represents all the custom document properties of the workbook.
      Specified by:
      getCustomViews in interface IWorkbook
    • getWriteProtection

      public WriteProtection getWriteProtection()
      Provides access to the workbook write protection options.
      Specified by:
      getWriteProtection in interface IWorkbook
    • getSignatures

      public ISignatureSet getSignatures()
      Gets a collection of Signature objects that correspond to the digital signature attached to a document.
      Specified by:
      getSignatures in interface IWorkbook
    • getTagJsonSerializer

      public static IJsonSerializer getTagJsonSerializer()
      Gets JSON serializer for custom type
      Returns:
      The JSON serializer for tag custom type.
    • setTagJsonSerializer

      public static void setTagJsonSerializer(IJsonSerializer value)
      Sets JSON serializer for custom type in from/to JSON.
      Parameters:
      value - The JSON serializer for tag custom type.
    • getValueJsonSerializer

      public static IJsonSerializer getValueJsonSerializer()
      Gets JSON serializer for custom type
      Returns:
      The JSON serializer for custom type.
    • setValueJsonSerializer

      public static void setValueJsonSerializer(IJsonSerializer value)
      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:
      getAutoParse in interface IWorkbook
    • setAutoParse

      public void setAutoParse(boolean value)
      Sets whether to automatically parse when setting a range value to a string value.
      Specified by:
      setAutoParse in interface IWorkbook
    • getAutoRoundValue

      public boolean getAutoRoundValue()
      Determines whether to round the number to 15 significant figures when getting the value.
      Specified by:
      getAutoRoundValue in interface IWorkbook
    • setAutoRoundValue

      public void setAutoRoundValue(boolean value)
      Sets whether to round the number to 15 significant figures when getting the value.
      Specified by:
      setAutoRoundValue in interface IWorkbook
    • getBookView

      public IWorkbookView getBookView()
      Returns an object that represents the view settings of this workbook.
      Specified by:
      getBookView in interface IWorkbook
    • getProtectStructure

      public boolean getProtectStructure()
      True if the order of the sheets in the workbook is protected. Read-only Boolean.
      Specified by:
      getProtectStructure in interface IWorkbook
    • getProtectWindows

      public boolean getProtectWindows()
      True if the windows of the workbook are protected. Read-only Boolean.
      Specified by:
      getProtectWindows in interface IWorkbook
    • getReferenceStyle

      public ReferenceStyle getReferenceStyle()
      Gets the reference style.
      Specified by:
      getReferenceStyle in interface IWorkbook
    • setReferenceStyle

      public void setReferenceStyle(ReferenceStyle value)
      Sets the reference style.
      Specified by:
      setReferenceStyle in interface IWorkbook
    • getWorksheets

      public IWorksheets getWorksheets()
      Gets a collection of worksheets contained in the workbook.
      Specified by:
      getWorksheets in interface IWorkbook
    • getActiveSheet

      public IWorksheet getActiveSheet()
      Gets the active sheet.
      Specified by:
      getActiveSheet in interface IWorkbook
    • getTheme

      public ITheme getTheme()
      Returns an instance of ITheme which provides access to the theme associated with a workbook.
      Specified by:
      getTheme in interface IWorkbook
    • setTheme

      public void setTheme(ITheme value)
      Sets the theme applied to the current workbook.
      Specified by:
      setTheme in interface IWorkbook
    • getIconSets

      public IIconSets getIconSets()
      Filters data in a workbook based on a cell icon from the IconSets collection.
      Specified by:
      getIconSets in interface IWorkbook
    • getDefaultTableStyle

      public String getDefaultTableStyle()
      Specifies the table style that is used as the default TableStyle.
      Specified by:
      getDefaultTableStyle in interface IWorkbook
    • setDefaultTableStyle

      public void setDefaultTableStyle(String value)
      Sets the table style name from the ITableStyleCollection collectionthat is used as the default TableStyle.
      Specified by:
      setDefaultTableStyle in interface IWorkbook
    • getCulture

      public Locale getCulture()
      Gets the culture info of workbook, default is Locale.getDefault().
      Specified by:
      getCulture in interface IWorkbook
    • setCulture

      public void setCulture(Locale value)
      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:
      setCulture in interface IWorkbook
      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:
      getEnableCalculation in interface IWorkbook
    • setEnableCalculation

      public void setEnableCalculation(boolean value)
      Sets whether the calculation engine is valid.
      Specified by:
      setEnableCalculation in interface IWorkbook
    • AddCustomFunction

      public static void AddCustomFunction(CustomFunction func)
      Add custom function into the function set.
      Parameters:
      func - the custom function instance.
    • AddCustomFunction

      public static void AddCustomFunction(CustomFunction func, boolean canOverride)
      Add custom function into the function set.
      Parameters:
      func - the custom function instance.
      canOverride - override the exist function.
    • getPivotCaches

      public IPivotCaches getPivotCaches()
      Gets a PivotCaches collection that represents all the PivotTable caches in the specified workbook.
      Specified by:
      getPivotCaches in interface IWorkbook
    • getSlicerCaches

      public ISlicerCaches getSlicerCaches()
      Gets the ISlicerCaches object associated with the workbook.
      Specified by:
      getSlicerCaches in interface IWorkbook
    • getUsedFonts

      public List<FontInfo> getUsedFonts()
      Gets all fonts information that are used on workbook.
      Specified by:
      getUsedFonts in interface IWorkbook
    • calculate

      public void calculate()
      Calculates formulas in the workbook as needed.
      Specified by:
      calculate in interface IWorkbook
    • dirty

      public void dirty()
      Designates all the formulas of the workbook to be recalculated when the next calculation occurs.
      Specified by:
      dirty in interface IWorkbook
    • getStyles

      public IStyleCollection getStyles()
      Provides access to the collection of cell styles in the current workbook.
      Specified by:
      getStyles in interface IWorkbook
    • getTableStyles

      public ITableStyleCollection getTableStyles()
      Gets the table styles used in the current workbook.
      Specified by:
      getTableStyles in interface IWorkbook
    • getNames

      public INames getNames()
      Returns the INames collection that represents the workbook-specified names.
      Specified by:
      getNames in interface IWorkbook
    • getAuthor

      public String getAuthor()
      Gets the author.
      Specified by:
      getAuthor in interface IWorkbook
    • setAuthor

      public void setAuthor(String value)
      Sets the author.
      Specified by:
      setAuthor in interface IWorkbook
    • isEncryptedFile

      public boolean isEncryptedFile(String fileName)
      Specifies whether the file is password protected.
      Specified by:
      isEncryptedFile in interface IWorkbook
      Parameters:
      fileName - The file name.
    • isEncryptedFile

      public boolean isEncryptedFile(InputStream fileStream)
      Specifies whether the file is password protected.
      Specified by:
      isEncryptedFile in interface IWorkbook
      Parameters:
      fileStream - The file stream.
    • toJson

      public String toJson()
      Generates a JSON string from the workbook.
      Specified by:
      toJson in interface IWorkbook
      Returns:
      the json string.
    • toJson

      public String toJson(SerializationOptions serializationOptions)
      Generates a JSON string from the workbook.
      Specified by:
      toJson in interface IWorkbook
      Parameters:
      serializationOptions - the SerializationOptions object.
      Returns:
      The JSON string
    • toJson

      public void toJson(OutputStream stream)
      Generates a zipped JSON string from the workbook.
      Specified by:
      toJson in interface IWorkbook
      Parameters:
      stream - the output stream.
    • toJson

      public void toJson(OutputStream stream, SerializationOptions serializationOptions)
      Generates a JSON stream from a workbook.
      Specified by:
      toJson in interface IWorkbook
      Parameters:
      stream - the output stream.
      serializationOptions - the SerializationOptions object.
    • fromJson

      public List<JsonError> fromJson(String json)
      Generates a workbook from the JSON string.
      Specified by:
      fromJson in interface IWorkbook
      Parameters:
      json - the input JSON string.
      Returns:
      the errors in the json.
    • fromJson

      public List<JsonError> fromJson(String json, DeserializationOptions deserializationOptions)
      Generates a workbook from a JSON string.
      Specified by:
      fromJson in interface IWorkbook
      Parameters:
      json - the JSON.
      deserializationOptions - the DeserializationOptions object.
      Returns:
      the errors in the JSON.
    • fromJson

      public List<JsonError> fromJson(InputStream stream)
      Generates a workbook from the JSON stream.
      Specified by:
      fromJson in interface IWorkbook
      Parameters:
      stream - the input stream.
      Returns:
      the errors in the json.
    • fromJson

      public List<JsonError> fromJson(InputStream stream, DeserializationOptions deserializationOptions)
      Generates a workbook from a JSON stream.
      Specified by:
      fromJson in interface IWorkbook
      Parameters:
      stream - the stream
      deserializationOptions - the DeserializationOptions object.
      Returns:
      the errors in the JSON.
    • fromSjsJson

      public void fromSjsJson(String json)
      Generates a workbook from a JSON string containing the contents of .sjs file format.
      Specified by:
      fromSjsJson in interface IWorkbook
      Parameters:
      json - The JSON string.
    • fromSjsJson

      public void fromSjsJson(String json, SjsOpenOptions openOptions)
      Generates a workbook from a JSON string containing the contents of .sjs file format.
      Specified by:
      fromSjsJson in interface IWorkbook
      Parameters:
      json - The JSON string.
      openOptions - The open options for opening SpreadJS .sjs file.
    • fromSjsJson

      public void fromSjsJson(InputStream stream)
      Generates a workbook from a JSON stream containing the contents of .sjs file format.
      Specified by:
      fromSjsJson in interface IWorkbook
      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:
      waitForCalculationToFinish in interface IWorkbook
    • getWebRequestHandler

      public static IWebRequestHandler 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

      public static void setWebRequestHandler(IWebRequestHandler webRequestHandler)
      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

      public void fromSjsJson(InputStream stream, SjsOpenOptions openOptions)
      Generates a workbook from a JSON stream containing the contents of .sjs file format.
      Specified by:
      fromSjsJson in interface IWorkbook
      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.
      Specified by:
      protect in interface IWorkbook
    • protect

      public void protect(boolean structure)
      Protects a workbook so that it cannot be modified.
      Specified by:
      protect in interface IWorkbook
      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).
    • protect

      public void protect(boolean structure, boolean windows)
      Protects a workbook so that it cannot be modified.
      Specified by:
      protect in interface IWorkbook
      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

      public void protect(String password)
      Protects a workbook so that it cannot be modified.
      Specified by:
      protect in interface IWorkbook
      Parameters:
      password - Password to protect the workbook.
    • protect

      public void protect(String password, boolean structure)
      Protects a workbook so that it cannot be modified.
      Specified by:
      protect in interface IWorkbook
      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

      public void protect(String password, boolean structure, boolean windows)
      Protects a workbook so that it cannot be modified.
      Specified by:
      protect in interface IWorkbook
      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.
      Specified by:
      unprotect in interface IWorkbook
    • unprotect

      public void unprotect(String password)
      Removes protection from the workbook.
      Specified by:
      unprotect in interface IWorkbook
      Parameters:
      password - Password to protect the workbook.
    • addDataSource

      public void addDataSource(String name, Object dataSource)
      Add data source for template.
      Specified by:
      addDataSource in interface IWorkbook
      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:
      processTemplate in interface IWorkbook
    • processTemplate

      public void processTemplate(CancellationToken cancellationToken)
      Start to process the template with global options and cancellation support.
      Specified by:
      processTemplate in interface IWorkbook
      Parameters:
      cancellationToken - The token to monitor for cancellation requests.
      Throws:
      CancellationException - Throws when the CancellationToken was 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

      public IWorkbook generateReport()
      Process the template and return the instance of report workbook.
      Specified by:
      generateReport in interface IWorkbook
      Returns:
      The new IWorkbook object.
    • generateReport

      public IWorkbook generateReport(IWorksheet... worksheets)
      Process the template and return the instance of report workbook.
      Specified by:
      generateReport in interface IWorkbook
      Parameters:
      worksheets - IWorksheet collection that need to be processed.
      Returns:
      The new IWorkbook object.
    • 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:
      getResetAdjacentRangeBorder in interface IWorkbook
    • 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:
      setResetAdjacentRangeBorder in interface IWorkbook
      Parameters:
      value - True to reset the border of adjacent ranges, false otherwise.
    • SetLicenseKey

      public static void SetLicenseKey(String key)
      Sets license for all workbook instances.

      Important: For licenses of the Chinese market, use SetLicenseFile orset license in the GCEXCEL_JAVA_DEPLOY_LICENSE_V7 environment variable instead.

      Parameters:
      key - The license key.
    • SetLicenseFile

      public static void SetLicenseFile(String licenseFilePath)
      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

      public final IGraphicsInfo getGraphicsInfo()
      Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information.
      Specified by:
      getGraphicsInfo in interface IWorkbook
    • setGraphicsInfo

      public final void setGraphicsInfo(IGraphicsInfo value)
      Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information.
      Specified by:
      setGraphicsInfo in interface IWorkbook
    • getSelectedSheets

      public final IWorksheets getSelectedSheets()
      Returns a IWorksheets collection that represents all the selected sheets in the specified workbook.
      Specified by:
      getSelectedSheets in interface IWorkbook
    • getExcelLinkSources

      public List<String> getExcelLinkSources()
      Returns the names of the linked excel documents.
      Specified by:
      getExcelLinkSources in interface IWorkbook
    • public void updateExcelLinks()
      Updates all the excel links.
      Specified by:
      updateExcelLinks in interface IWorkbook
    • public void updateExcelLink(String name)
      Updates a excel link.
      Specified by:
      updateExcelLink in interface IWorkbook
    • public void updateExcelLink(String name, IWorkbook sourceWorkbook)
      Updates a excel link.
      Specified by:
      updateExcelLink in interface IWorkbook
    • getNames

      public static String[] getNames(String fileName)
      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

      public 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".
      Parameters:
      fileStream - The fileStream of a workbook.
      Returns:
      An array of possible import names.
    • importData

      public static Object[][] importData(String fileName, String sourceName)
      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

      public static Object[][] importData(InputStream fileStream, String sourceName)
      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

      public void toSjsJson(OutputStream stream)
      Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream.
      Specified by:
      toSjsJson in interface IWorkbook
      Parameters:
      stream - The specified file stream.
    • toSjsJson

      public void toSjsJson(OutputStream stream, SjsSaveOptions options)
      Integrates all JSON files from the SpreadJS .sjs file into a single string, then put the string into the stream.
      Specified by:
      toSjsJson in interface IWorkbook
      Parameters:
      stream - The specified file stream.
      options - Option for opening SpreadJS .sjs file.
    • toSjsJson

      public String toSjsJson()
      Generates a JSON string from a workbook. It integrates all JSON files from the SpreadJS .sjs file into a single string.
      Specified by:
      toSjsJson in interface IWorkbook
      Returns:
      Json data.
    • toSjsJson

      public String toSjsJson(SjsSaveOptions options)
      Generates a JSON string from a workbook. It integrates all JSON files from the SpreadJS .sjs file into a single string.
      Specified by:
      toSjsJson in interface IWorkbook
      Parameters:
      options - Option for opening SpreadJS .sjs file.
      Returns:
      Json data.
    • convertBarcodeToPicture

      public void convertBarcodeToPicture()
      Convert the calculated barcodes to pictures and place them in their respective positions.
      The original barcode formulas will be cleared.
      The ImageType of converted image is ImageType.SVG.
      Specified by:
      convertBarcodeToPicture in interface IWorkbook
    • convertBarcodeToPicture

      public void convertBarcodeToPicture(ImageType imageType)
      Convert the calculated barcodes to pictures and place them in their respective positions.
      The original barcode formulas will be cleared.
      Not support ImageType.EMF and ImageType.WMF image types.
      Specified by:
      convertBarcodeToPicture in interface IWorkbook
      Parameters:
      imageType - Specify the ImageType of converted image.
      Throws:
      UnsupportedOperationException - If convert to ImageType.EMF or ImageType.WMF image type.
    • getShowPivotTableFieldList

      public boolean getShowPivotTableFieldList()
      Gets a value indicating whether the PivotTable field list can be shown. Default is true.
      Specified by:
      getShowPivotTableFieldList in interface IWorkbook
    • setShowPivotTableFieldList

      public void setShowPivotTableFieldList(boolean value)
      Sets a value indicating whether the PivotTable field list can be shown. Default is true.
      Specified by:
      setShowPivotTableFieldList in interface IWorkbook