asposecells.api

Class Workbook

Represents a root object to create an Excel spreadsheet.
The Workbook class denotes an Excel spreadsheet. Each spreadsheet can contain multiple worksheets. The basic feature of the class is to open and save native excel files. The class has some advanced features like copying data from other Workbooks, combining two Workbooks, converting Excel to PDF, rendering Excel to image and protecting the Excel spreadsheet.

Example:

The following example creates a Workbook, opens a file named designer.xls in it and makes the horizontal and vertical scroll bars invisible for the Workbook. It then replaces two string values with an Integer value and string value respectively within the spreadsheet and finally save it to file named result.xls.
# Use Aspose.Cells for Python via Java
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *

# Open an excel file
workbook = Workbook("Book2.xlsx")

# Set scroll bars
workbook.getSettings().setHScrollBarVisible(False)
workbook.getSettings().setVScrollBarVisible(False)

# Replace the placeholder string with new values
workbook.replace("OldInt", 100)

newString = "Hello!"
workbook.replace("OldString", newString)
saveOptions = XlsSaveOptions()
workbook.save("Book1.xls", saveOptions)

Constructor Summary
Workbook()
Initializes a new instance of the Workbook class.
Workbook(fileFormatType)
Initializes a new instance of the Workbook class.
Workbook(file)
Initializes a new instance of the Workbook class and open a file.
Workbook(file, loadOptions)
Initializes a new instance of the Workbook class and open a file.
 
Property Getters/Setters Summary
methodgetAbsolutePath()
method
           Gets and sets the absolute path of the file.
methodgetBuiltInDocumentProperties()
Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet.
methodgetCellsDataTableFactory()
Gets the factory for building ICellsDataTable from custom objects
methodgetColors()
Returns colors in the palette for the spreadsheet.
methodgetContentTypeProperties()
Gets the list of ContentTypeProperty objects in the workbook.
methodgetCountOfStylesInPool()
Gets number of the styles in the style pool.
methodgetCustomDocumentProperties()
Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.
methodgetCustomXmlParts()
Represents a Custom XML Data Storage Part (custom XML data within a package).
methodgetDataConnections()
Gets the ExternalConnection collection.
methodgetDataMashup()
Gets mashup data.
methodgetDataSorter()
Gets a DataSorter object to sort data.
methodgetDefaultStyle()
method
           Gets or sets the default Style object of the workbook.
methodgetFileFormat()
method
           Gets and sets the file format. The value of the property is FileFormatType integer constant.
methodgetFileName()
method
           Gets and sets the current file name.
methodhasMacro()
Indicates if this spreadsheet contains macro/VBA.
methodhasRevisions()
Gets if the workbook has any tracked changes
methodgetInterruptMonitor()
method
           Gets and sets the interrupt monitor.
methodisDigitallySigned()
Indicates if this spreadsheet is digitally signed.
methodisLicensed()
Indicates whether license is set.
methodisWorkbookProtectedWithPassword()
Indicates whether structure or window is protected with password.
methodgetRibbonXml()
method
           Gets and sets the XML file that defines the Ribbon UI.
methodgetSettings()
Represents the workbook settings.
methodgetTheme()
Gets the theme name.
methodgetVbaProject()
Gets the VbaProject in a spreadsheet.
methodgetWorksheets()
Gets the WorksheetCollection collection in the spreadsheet.
 
Method Summary
methodacceptAllRevisions()
Accepts all tracked changes in the workbook.
methodaddDigitalSignature(digitalSignatureCollection)
Adds digital signature to an OOXML spreadsheet file (Excel2007 and later).
methodcalculateFormula()
Calculates the result of formulas.
methodcalculateFormula(ignoreError)
Calculates the result of formulas.
methodcalculateFormula(options)
Calculating formulas in this workbook.
methodchangePalette(color, index)
Changes the palette for the spreadsheet in the specified index.
methodcloseAccessCache(opts)
Closes the session that uses caches to access data.
methodcombine(secondWorkbook)
Combines another Workbook object.
methodcopy(source)
Copies data from a source Workbook object.
methodcopy(source, copyOptions)
Copies another Workbook object.
methodcopyTheme(source)
Copies the theme from another workbook.
methodcreateBuiltinStyle(type)
Creates built-in style by given type.
methodcreateCellsColor()
Creates a CellsColor object.
methodcreateStyle()
Creates a new style.
static methodcreateWorkbookFromBytes(byte_array)
Initializes a new instance of the Workbook class and open a byte array.
static methodcreateWorkbookFromBytes(byte_array, loadOptions)
Initializes a new instance of the Workbook class and open a byte array.
methodcustomTheme(themeName, colors)
Customs the theme.
methoddispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
methodexportXml(mapName, stream)
Export XML data linked by the specified XML map.
methodexportXml(mapName, path)
Export XML data linked by the specified XML map.
methodgetDigitalSignature()
Gets digital signature from file.
methodgetFonts()
Gets all fonts in the style pool.
methodgetMatchingColor(rawColor)
Find best matching Color in current palette.
methodgetNamedStyle(name)
Gets the named style in the style pool.
methodgetStyleInPool(index)
Gets the style in the style pool. All styles in the workbook will be gathered into a pool. There is only a simple reference index in the cells.
methodgetThemeColor(type)
Gets theme color.
methodhasExernalLinks()
Indicates whether this workbook contains external links to other data sources.
methodimportXml(stream, sheetName, row, col)
Imports/Updates an XML data file into the workbook.
methodimportXml(url, sheetName, row, col)
Imports/Updates an XML data file into the workbook.
methodisColorInPalette(color)
Checks if a color is in the palette for the spreadsheet.
methodparseFormulas(ignoreError)
Parses all formulas which have not been parsed when they were loaded from template file or set to a cell.
methodprotect(protectionType, password)
Protects a workbook.
methodprotectSharedWorkbook(password)
Protects a shared workbook.
methodrefreshDynamicArrayFormulas(calculate)
Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data) Other formulas in the workbook will not be calculated recursively even if they were used by dynamic array formulas.
methodrefreshDynamicArrayFormulas(calculate, copts)
Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data)
methodremoveDigitalSignature()
Removes digital signature from this spreadsheet.
methodremoveExternalLinks()
Removes all external links in the workbook.
methodremoveMacro()
Removes VBA/macro from this spreadsheet.
methodremovePersonalInformation()
Removes personal information.
methodremoveUnusedStyles()
Remove all unused styles.
methodreplace(placeHolder, newValue)
Replaces a cell's value with a new double.
methodreplace(placeHolder, newValue)
Replaces a cell's value with a new integer.
methodreplace(placeHolder, newValue)
Replaces a cell's value with a new string.
methodreplace(placeHolder, newValue, options)
Replaces a cell's value with a new string.
methodreplace(placeHolder, newValues, isVertical)
Replaces a cell's value with a new string array.
methodsave(fileName)
Save the workbook to the disk.
methodsave(fileName, saveOptions)
Saves the workbook to the disk.
methodsave(fileName, saveFormat)
Saves the workbook to the disk.
methodsaveToBytes(saveFormat)
Save the workbook to a byte array.
methodsaveToBytes(saveOptions)
Save the workbook to a byte array.
methodsetDigitalSignature(digitalSignatureCollection)
Sets digital signature to an spreadsheet file (Excel2007 and later).
methodsetEncryptionOptions(encryptionType, keyLength)
Set Encryption Options.
methodsetThemeColor(type, color)
Sets the theme color
methodstartAccessCache(opts)
Starts the session that uses caches to access data.
methodunprotect(password)
Unprotects a workbook.
methodunprotectSharedWorkbook(password)
Unprotects a shared workbook.
methodupdateCustomFunctionDefinition(definition)
Updates definition of custom functions.
methodupdateLinkedDataSource(externalWorkbooks)
If this workbook contains external links to other data source, Aspose.Cells will attempt to retrieve the latest data from give sources.
 

    • Constructor Detail

      • Workbook

        Workbook()
        Initializes a new instance of the Workbook class. The default file format type is Xlsx. If you want to create other types of files, please use Workbook(FileFormatType).

        Example:

        The following code shows how to use the Workbook constructor to create and initialize a new instance of the class.
        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        workbook = Workbook()
      • Workbook

        Workbook(fileFormatType)
        Initializes a new instance of the Workbook class. The default file format type is Excel97To2003.
        Parameters:
        fileFormatType: int - A FileFormatType value. The new file format.

        Example:

        The following code shows how to use the Workbook constructor to create and initialize a new instance of the class.
        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        workbook = Workbook(FileFormatType.XLSX)
      • Workbook

        Workbook(file)
        Initializes a new instance of the Workbook class and open a file.
        Parameters:
        file: String - The file name.
      • Workbook

        Workbook(file, loadOptions)
        Initializes a new instance of the Workbook class and open a file.
        Parameters:
        file: String - The file name.
        loadOptions: LoadOptions - The load options
    • Property Getters/Setters Detail

      • isLicensed : boolean 

        boolean isLicensed()
        
        Indicates whether license is set.
      • getColors : Color[] 

        Color[] getColors()
        
        Returns colors in the palette for the spreadsheet. The palette has 56 entries, each represented by an RGB value.
      • getCountOfStylesInPool : int 

        int getCountOfStylesInPool()
        
        Gets number of the styles in the style pool.
      • getDefaultStyle/setDefaultStyle : Style 

        Style getDefaultStyle() / setDefaultStyle(value)
        
        Gets or sets the default Style object of the workbook. The DefaultStyle property is useful to implement a Style for the whole Workbook.

        Example:

        The following code creates and instantiates a new Workbook and sets a default Style to it.
        workbook = Workbook()
        defaultStyle = workbook.getDefaultStyle()
        defaultStyle.getFont().setName("Tahoma")
        workbook.setDefaultStyle(defaultStyle)
      • isDigitallySigned : boolean 

        boolean isDigitallySigned()
        
        Indicates if this spreadsheet is digitally signed.
      • isWorkbookProtectedWithPassword : boolean 

        boolean isWorkbookProtectedWithPassword()
        
        Indicates whether structure or window is protected with password.
      • hasMacro : boolean 

        boolean hasMacro()
        
        Indicates if this spreadsheet contains macro/VBA.
      • hasRevisions : boolean 

        boolean hasRevisions()
        
        Gets if the workbook has any tracked changes
      • getFileName/setFileName : String 

        String getFileName() / setFileName(value)
        
        Gets and sets the current file name. If the file is opened by stream and there are some external formula references, please set the file name.
      • getTheme : String 

        String getTheme()
        
        Gets the theme name.
      • getBuiltInDocumentProperties : BuiltInDocumentPropertyCollection 

        BuiltInDocumentPropertyCollection getBuiltInDocumentProperties()
        
        Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet. A new property cannot be added to built-in document properties list. You can only get a built-in property and change its value. The following is the built-in properties name list:

        Title

        Subject

        Author

        Keywords

        Comments

        Template

        Last Author

        Revision Number

        Application Name

        Last Print Date

        Creation Date

        Last Save Time

        Total Editing Time

        Number of Pages

        Number of Words

        Number of Characters

        Security

        Category

        Format

        Manager

        Company

        Number of Bytes

        Number of Lines

        Number of Paragraphs

        Number of Slides

        Number of Notes

        Number of Hidden Slides

        Number of Multimedia Clips

        Example:

        workbook = Workbook()
        doc = workbook.getBuiltInDocumentProperties().get("Author")
        doc.setValue("John Smith")
      • getFileFormat/setFileFormat : int 

        int getFileFormat() / setFileFormat(value)
        
        Gets and sets the file format. The value of the property is FileFormatType integer constant.
      • getCustomXmlParts : CustomXmlPartCollection 

        CustomXmlPartCollection getCustomXmlParts()
        
        Represents a Custom XML Data Storage Part (custom XML data within a package).
      • getRibbonXml/setRibbonXml : String 

        String getRibbonXml() / setRibbonXml(value)
        
        Gets and sets the XML file that defines the Ribbon UI.
      • getAbsolutePath/setAbsolutePath : String 

        String getAbsolutePath() / setAbsolutePath(value)
        
        Gets and sets the absolute path of the file. Only used for external links.
    • Method Detail

      • parseFormulas

         parseFormulas(ignoreError)
        Parses all formulas which have not been parsed when they were loaded from template file or set to a cell.
        Parameters:
        ignoreError: boolean - Whether ignore error for invalid formula. For one invalid formula, if ignore error then this formula will be ignored and the process will continue to parse other formulas, otherwise exception will be thrown.
      • startAccessCache

         startAccessCache(opts)
        Starts the session that uses caches to access data. If the cache of specified data access requires some data models in worksheet to be "read-only", then corresponding data models in every worksheet in this workbook will be taken as "read-only" and user should not change any of them.
        After finishing the access to the data, closeAccessCache(int) should be invoked with same options to clear all caches and recover normal access mode.
        Parameters:
        opts: int - A AccessCacheOptions value. options of data access
      • closeAccessCache

         closeAccessCache(opts)
        Closes the session that uses caches to access data.
        Parameters:
        opts: int - A AccessCacheOptions value. options of data access
      • save

         save(fileName, saveFormat)
        Saves the workbook to the disk.
        Parameters:
        fileName: String - The file name.
        saveFormat: int - A SaveFormat value. The save format type.

        Example:

        workbook = Workbook()
        sheets = workbook.getWorksheets()
        cells = sheets.get(0).getCells()
        cells.get("A1").putValue("Hello world!")
        workbook.save("Book1.xls", SaveFormat.EXCEL_97_TO_2003)
      • save

         save(fileName)
        Save the workbook to the disk.
        Parameters:
        fileName: String -
      • save

         save(fileName, saveOptions)
        Saves the workbook to the disk.
        Parameters:
        fileName: String - The file name.
        saveOptions: SaveOptions - The save options.
      • removeUnusedStyles

         removeUnusedStyles()
        Remove all unused styles.
      • createStyle

        Style createStyle()
        Creates a new style.
        Returns:
        Returns a style object.
      • createBuiltinStyle

        Style createBuiltinStyle(type)
        Creates built-in style by given type.
        Parameters:
        type: int - A BuiltinStyleType value. The builtin style stype.
        Returns:
        Style object
      • replace

        int replace(placeHolder, newValue)
        Replaces a cell's value with a new string.
        Parameters:
        placeHolder: String - Cell placeholder
        newValue: String - String value to replace

        Example:

        workbook = Workbook()
        workbook.replace("AnOldValue", "NewValue")
      • replace

        int replace(placeHolder, newValue)
        Replaces a cell's value with a new integer.
        Parameters:
        placeHolder: String - Cell placeholder
        newValue: int - Integer value to replace

        Example:

        workbook = Workbook()
        newValue = 100
        workbook.replace("AnOldValue", newValue)
      • replace

        int replace(placeHolder, newValue)
        Replaces a cell's value with a new double.
        Parameters:
        placeHolder: String - Cell placeholder
        newValue: float - Double value to replace

        Example:

        workbook = Workbook()
        newValue = 100.0
        workbook.replace("AnOldValue", newValue)
      • replace

        int replace(placeHolder, newValues, isVertical)
        Replaces a cell's value with a new string array.
        Parameters:
        placeHolder: String - Cell placeholder
        newValues: String[] - String array to replace
        isVertical: boolean - True - Vertical, False - Horizontal

        Example:

        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        workbook = Workbook("Book2.xlsx")
        workbook.replace("OldString", ["Tom", "Alice", "Jerry"], True)
      • replace

        int replace(placeHolder, newValue, options)
        Replaces a cell's value with a new string.
        Parameters:
        placeHolder: String - Cell placeholder
        newValue: String - String value to replace
        options: ReplaceOptions - The replace options
      • copy

         copy(source, copyOptions)
        Copies another Workbook object. It's very simple to clone an Excel file.
        Parameters:
        source: Workbook - Source Workbook object.
        copyOptions: CopyOptions - The options of copying other workbook.
      • copy

         copy(source)
        Copies data from a source Workbook object.
        Parameters:
        source: Workbook - Source Workbook object.
      • combine

         combine(secondWorkbook)
        Combines another Workbook object. Merge Excel, ODS , CSV and other files to one file.
        Parameters:
        secondWorkbook: Workbook - Another Workbook object.
      • getStyleInPool

        Style getStyleInPool(index)
        Gets the style in the style pool. All styles in the workbook will be gathered into a pool. There is only a simple reference index in the cells. If the returned style is changed, the style of all cells(which refers to this style) will be changed.
        Parameters:
        index: int - The index.
        Returns:
        The style in the pool corresponds to given index, may be null.
      • getFonts

        Font[] getFonts()
        Gets all fonts in the style pool.
      • getNamedStyle

        Style getNamedStyle(name)
        Gets the named style in the style pool.
        Parameters:
        name: String - name of the style
        Returns:
        named style, maybe null.
      • changePalette

         changePalette(color, index)
        Changes the palette for the spreadsheet in the specified index.

        The palette has 56 entries, each represented by an RGB value.

        If you set a color which is not in the palette, it will not take effect.

        So if you want to set a custom color, please change the palette at first.

        The following is the standard color palette.

        ColorRedGreenBlue
        Black000
        White255255255
        Red25500
        Lime02550
        Blue00255
        Yellow2552550
        Magenta2550255
        Cyan0255255
        Maroon12800
        Green01280
        Navy00128
        Olive1281280
        Purple1280128
        Teal0128128
        Silver192192192
        Gray128128128
        Color17153153255
        Color1815351102
        Color19255255204
        Color20204255255
        Color211020102
        Color22255128128
        Color230102204
        Color24204204255
        Color2500128
        Color262550255
        Color272552550
        Color280255255
        Color291280128
        Color3012800
        Color310128128
        Color3200255
        Color330204255
        Color34204255255
        Color35204255204
        Color36255255153
        Color37153204255
        Color38255153204
        Color39204153255
        Color40255204153
        Color4151102255
        Color4251204204
        Color431532040
        Color442552040
        Color452551530
        Color462551020
        Color47102102153
        Color48150150150
        Color49051102
        Color5051153102
        Color510510
        Color5251510
        Color53153510
        Color5415351102
        Color555151153
        Color56515151
        Parameters:
        color: Color - Color structure.
        index: int - Palette index, 0 - 55.
      • isColorInPalette

        boolean isColorInPalette(color)
        Checks if a color is in the palette for the spreadsheet.
        Parameters:
        color: Color - Color structure.
        Returns:
        Returns true if this color is in the palette. Otherwise, returns false
      • calculateFormula

         calculateFormula()
        Calculates the result of formulas. For all supported formulas, please see the list at https://docs.aspose.com/display/cellsnet/Supported+Formula+Functions
      • calculateFormula

         calculateFormula(ignoreError)
        Calculates the result of formulas.
        Parameters:
        ignoreError: boolean - Indicates if hide the error in calculating formulas. The error may be unsupported function, external links, etc.
      • calculateFormula

         calculateFormula(options)
        Calculating formulas in this workbook.
        Parameters:
        options: CalculationOptions - Options for calculation
      • refreshDynamicArrayFormulas

         refreshDynamicArrayFormulas(calculate)
        Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data) Other formulas in the workbook will not be calculated recursively even if they were used by dynamic array formulas.
        Parameters:
        calculate: boolean - Whether calculates and updates cell values for those dynamic array formulas
      • refreshDynamicArrayFormulas

         refreshDynamicArrayFormulas(calculate, copts)
        Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data) For performance consideration, we do not refresh all dynamic array formulas automatically when the formula itself or the data it references to changed. So user need to call this method manually after those operations which may influence dynamic array formulas, such as importing/setting cell values, inserting/deleting rows/columns/ranges, ...etc.
        For most formulas with functions, calculating the spill range also needs to calculating the formula, so in general true value for "calculate" flag is preferred. If the formula is simple, such as a range reference or array(for example "=C1:E5", "={1,2;3,4}", ...), simple function on a range or array(for example "=ABS(C1:E5)", "=1+{1,2;3,4}", ...), and all formulas will be calculated later(such as by calculateFormula(com.aspose.cells.CalculationOptions)), then using false vlaue for "calculate" flag may avoid the duplicated calculation for the benefit of performance.
        Parameters:
        calculate: boolean - Whether calculates and updates cell values for those dynamic array formulas
        copts: CalculationOptions - The options for calculating formulas
      • getMatchingColor

        Color getMatchingColor(rawColor)
        Find best matching Color in current palette.
        Parameters:
        rawColor: Color - Raw color.
        Returns:
        Best matching color.
      • setEncryptionOptions

         setEncryptionOptions(encryptionType, keyLength)
        Set Encryption Options.
        Parameters:
        encryptionType: int - A EncryptionType value. The encryption type.
        keyLength: int - The key length.
      • protect

         protect(protectionType, password)
        Protects a workbook.
        Parameters:
        protectionType: int - A ProtectionType value. Protection type.
        password: String - Password to protect the workbook.
      • protectSharedWorkbook

         protectSharedWorkbook(password)
        Protects a shared workbook.
        Parameters:
        password: String - Password to protect the workbook.
      • unprotect

         unprotect(password)
        Unprotects a workbook.
        Parameters:
        password: String - Password to unprotect the workbook.
      • unprotectSharedWorkbook

         unprotectSharedWorkbook(password)
        Unprotects a shared workbook.
        Parameters:
        password: String - Password to unprotect the workbook.
      • removeMacro

         removeMacro()
        Removes VBA/macro from this spreadsheet.
      • removeDigitalSignature

         removeDigitalSignature()
        Removes digital signature from this spreadsheet.
      • acceptAllRevisions

         acceptAllRevisions()
        Accepts all tracked changes in the workbook.
      • removeExternalLinks

         removeExternalLinks()
        Removes all external links in the workbook. NOTE: This member is now obsolete. Instead, please use ExternalLinkCollection.Clear() method. This method will be removed 12 months later since December 2021. Aspose apologizes for any inconvenience you may have experienced.
      • getThemeColor

        Color getThemeColor(type)
        Gets theme color.
        Parameters:
        type: int - A ThemeColorType value. The theme color type.
        Returns:
        The theme color.
      • setThemeColor

         setThemeColor(type, color)
        Sets the theme color
        Parameters:
        type: int - A ThemeColorType value. The theme color type.
        color: Color - the theme color
      • customTheme

         customTheme(themeName, colors)
        Customs the theme. The length of colors should be 12.
        Array indexTheme type
        0Backgournd1
        1Text1
        2Backgournd2
        3Text2
        4Accent1
        5Accent2
        6Accent3
        7Accent4
        8Accent5
        9Accent6
        10Hyperlink
        11Followed Hyperlink
        Parameters:
        themeName: String - The theme name
        colors: Color[] - The theme colors
      • copyTheme

         copyTheme(source)
        Copies the theme from another workbook.
        Parameters:
        source: Workbook - Source workbook.
      • hasExernalLinks

        boolean hasExernalLinks()
        Indicates whether this workbook contains external links to other data sources. NOTE: This member is now obsolete. Instead, please use ExternalLinkCollection.Count to check whether there are external links in this workbook. This method will be removed 12 months later since December 2021. Aspose apologizes for any inconvenience you may have experienced.
        Returns:
        Whether this workbook contains external links to other data sources.
      • updateCustomFunctionDefinition

         updateCustomFunctionDefinition(definition)
        Updates definition of custom functions. This method can be used for some special scenarios. For example, if user needs some parameters of some custom functions be calculated in array mode, then user may provide their own definition with implemented CustomFunctionDefinition.getArrayModeParameters(java.lang.String) for those functions. After the data of formulas being updated, those specified parameters will be calculated in array mode automatically when calculating corresponding custom functions.
        Parameters:
        definition: CustomFunctionDefinition - Special definition of custom functions for user's special requirement.
      • updateLinkedDataSource

         updateLinkedDataSource(externalWorkbooks)
        If this workbook contains external links to other data source, Aspose.Cells will attempt to retrieve the latest data from give sources. If corresponding external link cannot be found for one workbook, then this workbook will be ignored. So when you set a formula later with one new external link which you intend to make the ignored workbook be linked to it, the link cannot be performed until you call this this method again with those workbooks.
        Parameters:
        externalWorkbooks: Workbook[] - Workbooks that will be used to update data of external links referenced by this workbook. The match of those workbooks with external links is determined by FileName and ExternalLink.DataSource. So please make sure FileName has been specified with the proper value for every workbook so they can be linked to corresponding external link.
      • importXml

         importXml(url, sheetName, row, col)
        Imports/Updates an XML data file into the workbook.
        Parameters:
        url: String - the url/path of the xml file.
        sheetName: String - the destination sheet name.
        row: int - the destination row
        col: int - the destination column
      • importXml

         importXml(stream, sheetName, row, col)
        Imports/Updates an XML data file into the workbook.
        Parameters:
        stream: InputStream - the xml file stream.
        sheetName: String - the destination sheet name.
        row: int - the destination row.
        col: int - the destination column.
      • exportXml

         exportXml(mapName, path)
        Export XML data linked by the specified XML map.
        Parameters:
        mapName: String - name of the XML map that need to be exported
        path: String - the export path
      • exportXml

         exportXml(mapName, stream)
        Export XML data linked by the specified XML map.
        Parameters:
        mapName: String - name of the XML map that need to be exported
        stream: OutputStream - the export stream
      • setDigitalSignature

         setDigitalSignature(digitalSignatureCollection)
        Sets digital signature to an spreadsheet file (Excel2007 and later). Only support adding Xmldsig Digital Signature
        Parameters:
        digitalSignatureCollection: DigitalSignatureCollection -
      • addDigitalSignature

         addDigitalSignature(digitalSignatureCollection)
        Adds digital signature to an OOXML spreadsheet file (Excel2007 and later). Only support adding Xmldsig Digital Signature to an OOXML spreadsheet file
        Parameters:
        digitalSignatureCollection: DigitalSignatureCollection -
      • removePersonalInformation

         removePersonalInformation()
        Removes personal information.
      • dispose

         dispose()
        Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
      • createWorkbookFromBytes

        static  createWorkbookFromBytes(byte_array)
        Initializes a new instance of the Workbook class and open a byte array.
        Parameters:
        byte_array: bytes - The byte array

        Example:

        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        with open('Book2.xlsx', 'rb') as f:
            wb = Workbook.createWorkbookFromBytes(f.read())
            wb.save('result.xlsx')
        
        jpype.shutdownJVM()
        				
      • createWorkbookFromBytes

        static  createWorkbookFromBytes(byte_array, loadOptions)
        Initializes a new instance of the Workbook class and open a byte array.
        Parameters:
        byte_array: bytes - The byte array
        loadOptions: LoadOptions - The load options

        Example:

        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        loadOptions = LoadOptions()
        with open('Book2.xlsx', 'rb') as f:
            wb = Workbook.createWorkbookFromBytes(f.read(), loadOptions=loadOptions)
            wb.save('result.xlsx')
        
        jpype.shutdownJVM()
        				
      • saveToBytes

         saveToBytes(saveOptions)
        Save the workbook to a byte array.
        Parameters:
        saveOptions: SaveOptions - The save options
        Returns:
        A byte array.

        Example:

        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        wb = Workbook("Book2.xlsx")
        saveOptions = XlsSaveOptions()
        with open("wb.xls", "wb") as w:
            byte_array = wb.saveToBytes(saveOptions)
            w.write(byte_array)
        
        jpype.shutdownJVM()
        				
      • saveToBytes

         saveToBytes(saveFormat)
        Save the workbook to a byte array.
        Parameters:
        saveFormat: int - The save file format type
        Returns:
        A byte array.

        Example:

        import jpype
        import asposecells
        jpype.startJVM()
        from asposecells.api import *
        
        wb = Workbook("Book2.xlsx")
        with open("wb.xlsx", "wb") as w:
            byte_array = wb.saveToBytes(SaveFormat.XLSX)
            w.write(byte_array)
        
        jpype.shutdownJVM()