aspose.cells

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.
$designerFile = "book1.xls";
$workbook = new cells\Workbook($designerFile);

//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 = new cells\XlsSaveOptions();
$workbook->save("res.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
functiongetAbsolutePath()
function
           Gets and sets the absolute path of the file.
functiongetBuiltInDocumentProperties()
Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet.
functiongetCellsDataTableFactory()
Gets the factory for building ICellsDataTable from custom objects
functiongetColors()
Returns colors in the palette for the spreadsheet.
functiongetContentTypeProperties()
Gets the list of ContentTypeProperty objects in the workbook.
functiongetCountOfStylesInPool()
Gets number of the styles in the style pool.
functiongetCustomDocumentProperties()
Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.
functiongetCustomXmlParts()
Represents a Custom XML Data Storage Part (custom XML data within a package).
functiongetDataConnections()
Gets the ExternalConnection collection.
functiongetDataMashup()
Gets mashup data.
functiongetDataSorter()
Gets a DataSorter object to sort data.
functiongetDefaultStyle()
function
           Gets or sets the default Style object of the workbook.
functiongetFileFormat()
function
           Gets and sets the file format. The value of the property is FileFormatType integer constant.
functiongetFileName()
function
           Gets and sets the current file name.
functionhasMacro()
Indicates if this spreadsheet contains macro/VBA.
functionhasRevisions()
Gets if the workbook has any tracked changes
functiongetInterruptMonitor()
function
           Gets and sets the interrupt monitor.
functionisDigitallySigned()
Indicates if this spreadsheet is digitally signed.
functionisLicensed()
Indicates whether license is set.
functionisWorkbookProtectedWithPassword()
Indicates whether structure or window is protected with password.
functiongetRibbonXml()
function
           Gets and sets the XML file that defines the Ribbon UI.
functiongetSettings()
Represents the workbook settings.
functiongetTheme()
Gets the theme name.
functiongetVbaProject()
Gets the VbaProject in a spreadsheet.
functiongetWorksheets()
Gets the WorksheetCollection collection in the spreadsheet.
 
Method Summary
functionacceptAllRevisions()
Accepts all tracked changes in the workbook.
functionaddDigitalSignature(digitalSignatureCollection)
Adds digital signature to an OOXML spreadsheet file (Excel2007 and later).
functioncalculateFormula()
Calculates the result of formulas.
functioncalculateFormula(ignoreError)
Calculates the result of formulas.
functioncalculateFormula(options)
Calculating formulas in this workbook.
functionchangePalette(color, index)
Changes the palette for the spreadsheet in the specified index.
functioncloseAccessCache(opts)
Closes the session that uses caches to access data.
functioncombine(secondWorkbook)
Combines another Workbook object.
functioncopy(source)
Copies data from a source Workbook object.
functioncopy(source, copyOptions)
Copies another Workbook object.
functioncopyTheme(source)
Copies the theme from another workbook.
functioncreateBuiltinStyle(type)
Creates built-in style by given type.
functioncreateCellsColor()
Creates a CellsColor object.
functioncreateStyle()
Creates a new style.
functioncustomTheme(themeName, colors)
Customs the theme.
functiondispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
functionexportXml(mapName, stream)
Export XML data linked by the specified XML map.
functionexportXml(mapName, path)
Export XML data linked by the specified XML map.
functiongetDigitalSignature()
Gets digital signature from file.
functiongetFonts()
Gets all fonts in the style pool.
functiongetMatchingColor(rawColor)
Find best matching Color in current palette.
functiongetNamedStyle(name)
Gets the named style in the style pool.
functiongetStyleInPool(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.
functiongetThemeColor(type)
Gets theme color.
functionhasExernalLinks()
Indicates whether this workbook contains external links to other data sources.
functionimportXml(stream, sheetName, row, col)
Imports/Updates an XML data file into the workbook.
functionimportXml(url, sheetName, row, col)
Imports/Updates an XML data file into the workbook.
functionisColorInPalette(color)
Checks if a color is in the palette for the spreadsheet.
functionparseFormulas(ignoreError)
Parses all formulas which have not been parsed when they were loaded from template file or set to a cell.
functionprotect(protectionType, password)
Protects a workbook.
functionprotectSharedWorkbook(password)
Protects a shared workbook.
functionrefreshDynamicArrayFormulas(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.
functionrefreshDynamicArrayFormulas(calculate, copts)
Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data)
functionremoveDigitalSignature()
Removes digital signature from this spreadsheet.
functionremoveExternalLinks()
Removes all external links in the workbook.
functionremoveMacro()
Removes VBA/macro from this spreadsheet.
functionremovePersonalInformation()
Removes personal information.
functionremoveUnusedStyles()
Remove all unused styles.
functionreplace(placeHolder, newValue)
Replaces a cell's value with a new double.
functionreplace(placeHolder, newValue)
Replaces a cell's value with a new integer.
functionreplace(placeHolder, newValue)
Replaces a cell's value with a new string.
functionreplace(placeHolder, newValue, options)
Replaces a cell's value with a new string.
functionreplace(placeHolder, newValues, isVertical)
Replaces a cell's value with a new string array.
functionsave(fileName)
Save the workbook to the disk.
functionsave(fileName, saveOptions)
Saves the workbook to the disk.
functionsave(fileName, saveFormat)
Saves the workbook to the disk.
functionsetDigitalSignature(digitalSignatureCollection)
Sets digital signature to an spreadsheet file (Excel2007 and later).
functionsetEncryptionOptions(encryptionType, keyLength)
Set Encryption Options.
functionsetThemeColor(type, color)
Sets the theme color
functionstartAccessCache(opts)
Starts the session that uses caches to access data.
functionunprotect(password)
Unprotects a workbook.
functionunprotectSharedWorkbook(password)
Unprotects a shared workbook.
functionupdateCustomFunctionDefinition(definition)
Updates definition of custom functions.
functionupdateLinkedDataSource(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

        function 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).
      • Workbook

        function Workbook(fileFormatType)
        Initializes a new instance of the Workbook class. The default file format type is Excel97To2003.
        Parameters:
        fileFormatType: Number - 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.
        $workbook = new cells\Workbook(cells\FileFormatType::XLSX);
      • Workbook

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

        function 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

      • getSettings : WorkbookSettings 

        function getSettings()
        
        Represents the workbook settings.
      • isLicensed : boolean 

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

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

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

        function getDefaultStyle() / function 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 = new cells\Workbook();
        $defaultStyle = $workbook->getDefaultStyle();
        $defaultStyle->getFont()->setName("Tahoma");
        $workbook->setDefaultStyle($defaultStyle);
      • isDigitallySigned : boolean 

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

        function isWorkbookProtectedWithPassword()
        
        Indicates whether structure or window is protected with password.
      • getVbaProject : VbaProject 

        function getVbaProject()
        
        Gets the VbaProject in a spreadsheet.
      • hasMacro : boolean 

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

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

        function getFileName() / function 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.
      • getCellsDataTableFactory : CellsDataTableFactory 

        function getCellsDataTableFactory()
        
        Gets the factory for building ICellsDataTable from custom objects
      • getDataSorter : DataSorter 

        function getDataSorter()
        
        Gets a DataSorter object to sort data.
      • getTheme : String 

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

        function 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 = new cells\Workbook();
        $doc = $workbook->getBuiltInDocumentProperties()->get("Author");
        $doc->setValue("John Smith");
      • getCustomDocumentProperties : CustomDocumentPropertyCollection 

        function getCustomDocumentProperties()
        
        Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.

        Example:

        $workbook = new cells\Workbook();
        $workbook->getCustomDocumentProperties()->add("Checked by", "Jane");
      • getFileFormat/setFileFormat : Number 

        function getFileFormat() / function setFileFormat(value)
        
        Gets and sets the file format. The value of the property is FileFormatType integer constant.
      • getInterruptMonitor/setInterruptMonitor : AbstractInterruptMonitor 

        function getInterruptMonitor() / function setInterruptMonitor(value)
        
        Gets and sets the interrupt monitor.
      • getCustomXmlParts : CustomXmlPartCollection 

        function getCustomXmlParts()
        
        Represents a Custom XML Data Storage Part (custom XML data within a package).
      • getDataMashup : DataMashup 

        function getDataMashup()
        
        Gets mashup data.
      • getRibbonXml/setRibbonXml : String 

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

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

      • parseFormulas

        function 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

        function 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: Number - A AccessCacheOptions value. options of data access
      • closeAccessCache

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

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

        Example:

        $workbook = new cells\Workbook();
        $sheets = $workbook->getWorksheets();
        $cells = $sheets->get(0)->getCells();
        $cells->get("A1")->putValue("Hello world!");
        $workbook->save("res.xls", cells\SaveFormat::EXCEL_97_TO_2003);
      • save

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

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

        function removeUnusedStyles()
        Remove all unused styles.
      • createStyle

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

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

        function createCellsColor()
        Creates a CellsColor object.
        Returns:
        Returns a CellsColor object.
      • replace

        function 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 = new cells\Workbook();
        $cells = $workbook->getWorksheets()->get(0)->getCells();
        $cells->get(0, 0)->putValue("AnOldValue");
        $cells->get(0, 1)->putValue("AnotherOldValue");
        $workbook->replace("AnOldValue", "NewValue");
      • replace

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

        Example:

        $workbook = new cells\Workbook();
        $cells = $workbook->getWorksheets()->get(0)->getCells();
        $cells->get(0, 0)->putValue("AnOldValue");
        $cells->get(0, 1)->putValue("AnotherOldValue");
        $newValue = 100;
        $workbook->replace("AnOldValue", $newValue);
      • replace

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

        Example:

        $workbook = new cells\Workbook();
        $cells = $workbook->getWorksheets()->get(0)->getCells();
        $cells->get(0, 0)->putValue("AnOldValue");
        $cells->get(0, 1)->putValue("AnotherOldValue");
        $newValue = 100.1;
        $workbook->replace("AnOldValue", $newValue);
      • replace

        function 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:

        $workbook = new cells\Workbook();
        $cells = $workbook->getWorksheets()->get(0)->getCells();
        $cells->get(0, 0)->putValue("AnOldValue");
        $cells->get(0, 1)->putValue("AnotherOldValue");
        $ExampleUtil = new Java("ExampleUtil");
        $newValues = ["Tom", "Alice", "Jerry"];
        $workbook->replace("AnOldValue", $newValues, true);
      • replace

        function 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

        function 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

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

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

        function 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: Number - The index.
        Returns:
        The style in the pool corresponds to given index, may be null.
      • getFonts

        function getFonts()
        Gets all fonts in the style pool.
      • getNamedStyle

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

        function 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: Number - Palette index, 0 - 55.
      • isColorInPalette

        function 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

        function 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

        function 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

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

        function 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

        function 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

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

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

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

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

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

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

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

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

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

        function 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

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

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

        function 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

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

        function 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

        function 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

        function 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

        function 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: Number - the destination row
        col: Number - the destination column
      • importXml

        function 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: Number - the destination row.
        col: Number - the destination column.
      • exportXml

        function 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

        function 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

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

        function 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 -
      • getDigitalSignature

        function getDigitalSignature()
        Gets digital signature from file.
      • removePersonalInformation

        function removePersonalInformation()
        Removes personal information.
      • dispose

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