Example:
workbook = Workbook() sheets = workbook.getWorksheets() # Add a worksheet sheets.add() # Change the name of a worksheet sheets.get(0).setName("First Sheet") # Set the active sheet to the second worksheet sheets.setActiveSheetIndex(1)
Property Getters/Setters Summary | ||
---|---|---|
method | getActiveSheetIndex() | |
method | setActiveSheetIndex(value) | |
Represents the index of active worksheet when the spreadsheet is opened. | ||
method | getActiveSheetName() | |
method | setActiveSheetName(value) | |
Represents the name of active worksheet when the spreadsheet is opened. | ||
method | getBuiltInDocumentProperties() | |
Returns a |
||
method | getCount() | |
method | getCustomDocumentProperties() | |
Returns a |
||
method | getDxfs() | |
Gets the master differential formatting records.
|
||
method | getExternalLinks() | |
Represents external links in a workbook.
|
||
method | isRefreshAllConnections() | |
method | setRefreshAllConnections(value) | |
Indicates whether refresh all connections on opening file in MS Excel. | ||
method | getNames() | |
Gets the collection of all the Name objects in the spreadsheet.
|
||
method | getOleSize() | |
method | setOleSize(value) | |
Gets and Sets displayed size when Workbook file is used as an Ole object. | ||
method | getRevisionLogs() | |
Represents revision logs.
|
||
method | getTableStyles() | |
Gets |
||
method | getThreadedCommentAuthors() | |
Gets the list of threaded comment authors.
|
||
method | getWebExtensions() | |
Gets the list of task panes.
|
||
method | getWebExtensionTaskPanes() | |
Gets the list of task panes.
|
||
method | getXmlMaps() | |
method | setXmlMaps(value) | |
Gets and sets the XML maps in the workbook. | ||
method | get(index) | |
Gets the |
||
method | get(sheetName) | |
Gets the |
Method Summary | ||
---|---|---|
method | add() | |
Adds a worksheet to the collection.
|
||
method | add(type) | |
Adds a worksheet to the collection.
|
||
method | add(value) | |
Reserved for internal use. |
||
method | add(sheetName) | |
Adds a worksheet to the collection.
|
||
method | addCopy(source, destSheetNames) | |
Copy a group of worksheets.
|
||
method | addCopy(sheetIndex) | |
Adds a worksheet to the collection and copies data from an existed worksheet.
|
||
method | addCopy(sheetName) | |
Adds a worksheet to the collection and copies data from an existed worksheet.
|
||
method | clear() | |
Clear all worksheets.
|
||
method | clearPivottables() | |
Clears pivot tables from the spreadsheet.
|
||
method | contains(value) | |
Reserved for internal use. |
||
method | createRange(address, sheetIndex) | |
Creates a |
||
method | createUnionRange(address, sheetIndex) | |
Creates a |
||
method | get(index) | |
Reserved for internal use. |
||
method | getNamedRanges() | |
Gets all pre-defined named ranges in the spreadsheet.
|
||
method | getNamedRangesAndTables() | |
Gets all pre-defined named ranges in the spreadsheet.
|
||
method | getRangeByName(rangeName) | |
Gets Range object by pre-defined name.
|
||
method | getRangeByName(rangeName, currentSheetIndex, includeTable) | |
Gets |
||
method | getSheetByCodeName(codeName) | |
Gets the worksheet by the code name.
|
||
method | indexOf(value) | |
Reserved for internal use. |
||
method | insert(index, sheetType) | |
Insert a worksheet.
|
||
method | insert(index, sheetType, sheetName) | |
Insert a worksheet.
|
||
method | iterator() | |
method | refreshAll() | |
Refresh all pivot tables and charts with pivot source.
|
||
method | refreshPivotTables() | |
Refreshes all the PivotTables in the Excel file.
|
||
method | refreshPivotTables(option) | |
Refreshes all the PivotTables in the Excel file.
|
||
method | registerAddInFunction(id, functionName) | |
Adds addin function into the workbook
|
||
method | registerAddInFunction(addInFile, functionName, lib) | |
Adds addin function into the workbook
|
||
method | removeAt(index) | |
Removes the element at a specified index.
|
||
method | removeAt(name) | |
Removes the element at a specified name.
|
||
method | setOleSize(startRow, endRow, startColumn, endColumn) | |
Sets displayed size when Workbook file is used as an Ole object.
|
||
method | sortNames() | |
Sorts the defined names.
|
||
method | swapSheet(sheetIndex1, sheetIndex2) | |
Swaps the two sheets.
|
WebExtensionTaskPaneCollection getWebExtensionTaskPanes()
WebExtensionCollection getWebExtensions()
ThreadedCommentAuthorCollection getThreadedCommentAuthors()
boolean isRefreshAllConnections() / setRefreshAllConnections(value)
NameCollection getNames()
String getActiveSheetName() / setActiveSheetName(value)
int getActiveSheetIndex() / setActiveSheetIndex(value)
DxfCollection getDxfs()
XmlMapCollection getXmlMaps() / setXmlMaps(value)
BuiltInDocumentPropertyCollection getBuiltInDocumentProperties()
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.getWorksheets().getBuiltInDocumentProperties().get("Author") doc.setValue("John Smith")
CustomDocumentPropertyCollection getCustomDocumentProperties()
Example:
workbook = Workbook() workbook.getWorksheets().getCustomDocumentProperties().add("Checked by", "Jane")
Object getOleSize() / setOleSize(value)
ExternalLinkCollection getExternalLinks()
TableStyleCollection getTableStyles()
RevisionLogCollection getRevisionLogs()
int getCount()
Worksheet get(index)
index
- The zero based index of the element.Worksheet get(sheetName)
sheetName
- Worksheet namesetOleSize(startRow, endRow, startColumn, endColumn)
startRow: int
- Start row index.endRow: int
- End row index.startColumn: int
- Start column index.endColumn: int
- End column index.clearPivottables()
refreshAll()
refreshPivotTables()
refreshPivotTables(option)
option: PivotTableRefreshOption
-
The option for refreshing data source of the pivot tables.
Range createRange(address, sheetIndex)
UnionRange createUnionRange(address, sheetIndex)
Worksheet getSheetByCodeName(codeName)
codeName: String
- Worksheet code name.sortNames()
Worksheet insert(index, sheetType)
index: int
- The sheet indexsheetType: int
- A Worksheet insert(index, sheetType, sheetName)
index: int
- The sheet indexsheetType: int
- A sheetName: String
- The sheet name.int add(type)
type: int
- A Example:
workbook = Workbook() workbook.getWorksheets().add(SheetType.CHART) cells = workbook.getWorksheets().get(0).getCells() cells.get("c2").putValue(5000) cells.get("c3").putValue(3000) cells.get("c4").putValue(4000) cells.get("c5").putValue(5000) cells.get("c6").putValue(6000) charts = workbook.getWorksheets().get(1).getCharts() chartIndex = charts.add(ChartType.COLUMN, 10, 10, 20, 20) chart = charts.get(chartIndex) chart.getNSeries().add("Sheet1!C2:C6", True) workbook.save("Book1.xlsx")
swapSheet(sheetIndex1, sheetIndex2)
sheetIndex1: int
- The first worksheet.sheetIndex2: int
- The second worksheet.int add()
Worksheet add(sheetName)
sheetName: String
- Worksheet nameint registerAddInFunction(addInFile, functionName, lib)
addInFile: String
- the file contains the addin functionsfunctionName: String
- the addin function namelib: boolean
- whether the given addin file is in the directory or sub-directory of Workbook Add-In library.
This flag takes effect and makes difference when given addInFile is of relative path:
true denotes the path is relative to Add-In library and false denotes the path is relative to this Workbook.String registerAddInFunction(id, functionName)
id: int
- ID of the data which contains addin functions,
can be got by the first call of functionName: String
- the addin function nameremoveAt(name)
name: String
- The name of the element to remove.removeAt(index)
index: int
- The index value of the element to remove.clear()
int addCopy(sheetName)
sheetName: String
- Name of source worksheet.int addCopy(sheetIndex)
sheetIndex: int
- Index of source worksheet.addCopy(source, destSheetNames)
source: Worksheet[]
- The source worksheets.destSheetNames: String[]
- The names of the copied sheets.Range getRangeByName(rangeName)
rangeName: String
- Name of range.Range getRangeByName(rangeName, currentSheetIndex, includeTable)
rangeName: String
- Name of range or table's name.currentSheetIndex: int
- The sheet index. -1 represents global .includeTable: boolean
- Indicates whether checking all tables.Range[] getNamedRanges()
Range[] getNamedRangesAndTables()
Iterator iterator()
Object get(index)
boolean contains(value)
int add(value)
int indexOf(value)