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 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.
Workbook(byte_array)
           Initializes a new instance of the Workbook class and open a byte array.
Workbook(byte_array, loadOptions)
           Initializes a new instance of the Workbook class and open a byte array.
 
Property Getters/Setters Summary
methodgetAbsolutePath()
methodsetAbsolutePath(value)
           Gets and sets the absolute path of the file.
methodgetBuiltInDocumentProperties()
           Returns a DocumentProperties collection that represents all the built-in document properties of the spreadsheet.
methodgetColors()
           Returns colors in the palette for the spreadsheet.
methodgetContentTypeProperties()
           Gets the contenttypeproperties objects in the workbook.
methodgetCountOfStylesInPool()
           Gets number of the styles in the style pool.
methodgetCustomDocumentProperties()
           Returns a DocumentProperties collection that represents all the custom document properties of the spreadsheet.
methodgetCustomXmlParts()
           Represents a InnerCustom XML Data Storage Part (custom XML data within a package).
methodgetDataConnections()
           Gets the Aspose.Cells.ExternalConnections.ExternalConnection collection.
methodgetDataMashup()
           Gets mashup data.
methodgetDataSorter()
           Gets a DataSorter object to sort data.
methodgetDefaultStyle()
methodsetDefaultStyle(value)
           Gets or sets the default Style object of the workbook.
methodgetFileFormat()
methodsetFileFormat(value)
           Gets and sets the file format. The value of the property is FileFormatType integer constant.
methodgetFileName()
methodsetFileName(value)
           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()
methodsetInterruptMonitor(value)
           Gets and sets the interrupt monitor.
methodisDigitallySigned()
           Indicates if this spreadsheet is digitally signed.
methodisLicensed()
           Indicates whether license is set.
methodgetRibbonXml()
methodsetRibbonXml(value)
           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(ignoreError, customFunction)
           Calculates the result of formulas.
methodcalculateFormula(options)
           Calcualting formulas in this workbook.
methodchangePalette(color, index)
           Changes the palette for the spreadsheet in the specified index.
methodcombine(secondWorkbook)
           Combines another Workbook object.
methodcopy(source0)
           Copies data from a source 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.
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.
methodexportXml(mapName, path)
           Export XML data.
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 an xml file into the workbook.
methodimportXml(url, sheetName, row, col)
           Imports an xml file into the workbook.
methodisColorInPalette(color)
           Checks if a color is in the palette for the spreadsheet.
methodprotect(protectionType, password)
           Protects a workbook.
methodprotectSharedWorkbook(password)
           Protects a shared workbook.
methodremoveDigitalSignature()
           Removes digital signature from this spreadsheet.
methodremoveExternalLinks()
           Removes all external links in the workbook.
methodremoveMacro()
           Removes VBA/macro from this spreadsheet.
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
methodunprotect(password)
           Unprotects a workbook.
methodunprotectSharedWorkbook(password)
           Unprotects a shared workbook.
methodupdateLinkedDataSource(exteralWorkbooks)
           If this workbook contains external links to other data source, Aspose.Cells will attempt to retrieve the latest data.
 

Constructor Detail

Workbook

Workbook()
Initializes a new instance of the Workbook class. The default file format type is Excel97To2003.If want create other format file type, please call Workbook(FileFormatType 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

Workbook

Workbook(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(f.read())
    wb.save('result.xlsx')

jpype.shutdownJVM()
				

Workbook

Workbook(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(f.read(), loadOptions)
    wb.save('result.xlsx')

jpype.shutdownJVM()
				

Property Getters/Setters Detail

getSettings : WorkbookSettings 

WorkbookSettings getSettings()
Represents the workbook settings.

getWorksheets : WorksheetCollection 

WorksheetCollection getWorksheets()
Gets the WorksheetCollection collection in the spreadsheet.
Returns:
WorksheetCollection collection

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.

getVbaProject : VbaProject 

VbaProject getVbaProject()
Gets the VbaProject in a spreadsheet.

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.

getDataSorter : DataSorter 

DataSorter getDataSorter()
Gets a DataSorter object to sort data.

getTheme : String 

String getTheme()
Gets the theme name.

getBuiltInDocumentProperties : BuiltInDocumentPropertyCollection 

BuiltInDocumentPropertyCollection getBuiltInDocumentProperties()
Returns a DocumentProperties 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")

getCustomDocumentProperties : CustomDocumentPropertyCollection 

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

Example:

workbook = Workbook()
workbook.getCustomDocumentProperties().add("Checked by", "Jane")

getFileFormat/setFileFormat : int 

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

getInterruptMonitor/setInterruptMonitor : InterruptMonitor 

InterruptMonitor getInterruptMonitor() / setInterruptMonitor(value)
Gets and sets the interrupt monitor.

getContentTypeProperties : ContentTypePropertyCollection 

ContentTypePropertyCollection getContentTypeProperties()
Gets the contenttypeproperties objects in the workbook.

getCustomXmlParts : CustomXmlPartCollection 

CustomXmlPartCollection getCustomXmlParts()
Represents a InnerCustom XML Data Storage Part (custom XML data within a package).

getDataMashup : DataMashup 

DataMashup getDataMashup()
Gets mashup data.

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.

getDataConnections : ExternalConnectionCollection 

ExternalConnectionCollection getDataConnections()
Gets the Aspose.Cells.ExternalConnections.ExternalConnection collection.

Method Detail

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.
Returns:
style object

createCellsColor

CellsColor createCellsColor()
Creates a CellsColor object.
Returns:
Returns a CellsColor 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(source0)
Copies data from a source Workbook object.
Parameters:
source0: Workbook - Source Workbook object.

combine

 combine(secondWorkbook)
Combines another Workbook object. Currently, only cell data and cell style of the second Workbook object can be combined. Images, charts and other drawing objects are not supported.
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.

Color¡¡Red¡¡Green¡¡Blue¡¡
Black¡¡0¡¡0¡¡0¡¡
White¡¡255¡¡255¡¡255¡¡
Red¡¡255¡¡0¡¡0¡¡
Lime¡¡0¡¡255¡¡0¡¡
Blue¡¡0¡¡0¡¡255¡¡
Yellow¡¡255¡¡255¡¡0¡¡
Magenta¡¡255¡¡0¡¡255¡¡
Cyan¡¡0¡¡255¡¡255¡¡
Maroon¡¡128¡¡0¡¡0¡¡
Green¡¡0¡¡128¡¡0¡¡
Navy¡¡0¡¡0¡¡128¡¡
Olive¡¡128¡¡128¡¡0¡¡
Purple¡¡128¡¡0¡¡128¡¡
Teal¡¡0¡¡128¡¡128¡¡
Silver¡¡192¡¡192¡¡192¡¡
Gray¡¡128¡¡128¡¡128¡¡
Color17¡¡153¡¡153¡¡255¡¡
Color18¡¡153¡¡51¡¡102¡¡
Color19¡¡255¡¡255¡¡204¡¡
Color20¡¡204¡¡255¡¡255¡¡
Color21¡¡102¡¡0¡¡102¡¡
Color22¡¡255¡¡128¡¡128¡¡
Color23¡¡0¡¡102¡¡204¡¡
Color24¡¡204¡¡204¡¡255¡¡
Color25¡¡0¡¡0¡¡128¡¡
Color26¡¡255¡¡0¡¡255¡¡
Color27¡¡255¡¡255¡¡0¡¡
Color28¡¡0¡¡255¡¡255¡¡
Color29¡¡128¡¡0¡¡128¡¡
Color30¡¡128¡¡0¡¡0¡¡
Color31¡¡0¡¡128¡¡128¡¡
Color32¡¡0¡¡0¡¡255¡¡
Color33¡¡0¡¡204¡¡255¡¡
Color34¡¡204¡¡255¡¡255¡¡
Color35¡¡204¡¡255¡¡204¡¡
Color36¡¡255¡¡255¡¡153¡¡
Color37¡¡153¡¡204¡¡255¡¡
Color38¡¡255¡¡153¡¡204¡¡
Color39¡¡204¡¡153¡¡255¡¡
Color40¡¡255¡¡204¡¡153¡¡
Color41¡¡51¡¡102¡¡255¡¡
Color42¡¡51¡¡204¡¡204¡¡
Color43¡¡153¡¡204¡¡0¡¡
Color44¡¡255¡¡204¡¡0¡¡
Color45¡¡255¡¡153¡¡0¡¡
Color46¡¡255¡¡102¡¡0¡¡
Color47¡¡102¡¡102¡¡153¡¡
Color48¡¡150¡¡150¡¡150¡¡
Color49¡¡0¡¡51¡¡102¡¡
Color50¡¡51¡¡153¡¡102¡¡
Color51¡¡0¡¡51¡¡0¡¡
Color52¡¡51¡¡51¡¡0¡¡
Color53¡¡153¡¡51¡¡0¡¡
Color54¡¡153¡¡51¡¡102¡¡
Color55¡¡51¡¡51¡¡153¡¡
Color56¡¡51¡¡51¡¡51¡¡
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.

Now Workbook built-in functions are not supported in this method:

[A]

ASC

[B]

BAHTTEXT

[C]

CALL, CLEAN, CODE, CONVERT, CUBEKPIMEMBER, CUBEMEMBER, CUBEMEMBERPROPERTY, CUBERANKEDMEMBER, CUBESET, CUBESETCOUNT, CUBEVALUE

[E]

EUROCONVERT

[I]

INFO

[J]

JIS

[P]

PHONETIC

[R]

REGISTER.ID, RTD

[S]

SQL.REQUEST


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(ignoreError, customFunction)
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.
customFunction: ICustomFunction - The custom formula calculation functions to extend the calculation engine.

calculateFormula

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

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.

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 index¡¡Theme type¡¡
0¡¡Backgournd1¡¡
1¡¡Text1¡¡
2¡¡Backgournd2¡¡
3¡¡Text2¡¡
4¡¡Accent1¡¡
5¡¡Accent2¡¡
6¡¡Accent3¡¡
7¡¡Accent4¡¡
8¡¡Accent5¡¡
9¡¡Accent6¡¡
10¡¡Hyperlink¡¡
11¡¡Followed 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.
Returns:
Whether this workbook contains external links to other data sources.

updateLinkedDataSource

 updateLinkedDataSource(exteralWorkbooks)
If this workbook contains external links to other data source, Aspose.Cells will attempt to retrieve the latest data. If the method is not called before calculating formulas, Aspose.Cells will use the previous information(cached in the file); Please set CellsHelper.StartupPath,CellsHelper.AltStartPath,CellsHelper.LibraryPath. And please set Workbook.FilePath if this workbook is from a stream, otherwise Aspose.Cells could not get the external link full path sometimes.
Parameters:
exteralWorkbooks: Workbook[] - External workbooks are referenced by this workbook. If it's null, we will directly open the external linked files.. If it's not null, we will check whether the external link in the array first; if not, we will open the external linked files again.

importXml

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

importXml

 importXml(stream, sheetName, row, col)
Imports an xml file into the workbook.
Parameters:
stream: InputStream - the xml file stream.
sheetName: String - the destination sheet name .
row: int - the destination row of the xml.
col: int - the destination column of the xml.

exportXml

 exportXml(mapName, path)
Export XML data.
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.
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 -

getDigitalSignature

DigitalSignatureCollection getDigitalSignature()
Gets digital signature from file.

dispose

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

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()
				

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.