接口 IWorkbook
- 所有已知实现类:
Workbook
public interface IWorkbook
Represents an IWorkbook object.
-
方法概要
修饰符和类型方法说明void
addDataSource
(String name, Object dataSource) Add data source for templatevoid
Calculates formulas of the workbook as needed.void
dirty()
Designates all the formulas of the workbook to be recalculated when the next calculation occurs.Process the template and return the instance of report workbook.generateReport
(IWorksheet... worksheets) Process the template and return the instance of report workbook.Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook.boolean
已过时。Gets the author.boolean
Gets whether to automatically parse when setting a range value to a string value.boolean
Gets whether to round the number to 15 significant figures when getting the value.Returns an object that represents the view settings of this workbook.Gets a collection that represents all the built-in document properties of the workbook.Gets culture info for the workbook.Gets a collection that represents all the custom document properties of the workbook.Gets the custom views of the workbook.Gets the table style name from theITableStyleCollection
collectionthat is used as the default TableStyle.boolean
Gets whether update the dirty state of the formula cells immediately when changing the value of a cell.boolean
Gets whether the calculation engine is valid.Returns the name of the workbook, including its path on disk.Provides graphics information.Filters data in a workbook based on a cell icon from the IconSets collection.getName()
Gets a string value that represents the name of the workbook.getNames()
Returns theINames
collection that represents all the names in thespecified workbook (including all worksheet-specific names).Returns theIExcelOptions
object that represents some settings to control workbook behavior.getPath()
Gets a string that represents the path to the workbook file that this workbook object represents.Returns theIPivotCaches
collection that represents all theIPivotTable
caches in the specified workbook.boolean
True if the order of the sheets in the workbook is protected.boolean
True if the windows of the workbook are protected.Gets the reference style.boolean
Determines whether to reset adjacent range's border when setting border for a range.Returns aIWorksheets
collectionthat represents all the selected sheets in the specified workbook.Gets a collection of Signature objects that correspond to the digital signature attached to a document.Gets theISlicerCaches
object associated with the workbook.Returns theIStyleCollection
collection that represents all thestyles in the specified workbook.Returns theITableStyleCollection
collection object for the currentworkbook that refers to the styles used in the current workbook.getTheme()
Returns the theme applied to the current workbook.Returns theIWorksheets
collection that represents all the worksheetsin the specified workbook.Returns aWriteProtection
object that provides access to the workbook write protection options.boolean
isEncryptedFile
(InputStream fileStream) Specifies whether the file is password protected.boolean
isEncryptedFile
(String fileName) Specifies whether the file is password protected.void
open
(InputStream fileStream) Opens the specified excel file stream.void
open
(InputStream fileStream, OpenFileFormat fileFormat) Opens the specified format file stream.void
open
(InputStream fileStream, OpenOptionsBase options) Opens the stream with specified options, the open options can be XlsxOpenOptions, CsvOpenOptions.void
open
(InputStream fileStream, String password) Opens the specified excel file stream.void
Opens the specified excel filevoid
open
(String fileName, OpenFileFormat fileFormat) Opens the specified format file.void
open
(String fileName, OpenOptionsBase options) Opens the file with specified options, the open options can be XlsxOpenOptions, CSVOpenOptions.void
Opens the specified excel filevoid
Start to process the templatevoid
protect()
Protects a workbook so that it cannot be modified.void
protect
(boolean structure) Protects a workbook so that it cannot be modified.void
protect
(boolean structure, boolean windows) Protects a workbook so that it cannot be modified.void
Protects a workbook so that it cannot be modified.void
Protects a workbook so that it cannot be modified.void
Protects a workbook so that it cannot be modified.void
save
(OutputStream outputStream) Saves the workbook to the stream.void
save
(OutputStream fileStream, SaveFileFormat fileFormat) Saves the specified format file stream.void
save
(OutputStream fileStream, SaveOptionsBase options) Saves workbook to stream with specified options.void
save
(OutputStream outputStream, String password) Saves data to the specified excel file stream.void
Saves the workbook to the disk.void
save
(String fileName, SaveFileFormat fileFormat) Saves the specified format file.void
save
(String fileName, SaveOptionsBase options) Saves workbook to file with specified options.void
Saves data to the specified excel file.void
setAllowDynamicArray
(boolean value) 已过时。void
Sets the author.void
setAutoParse
(boolean value) Sets whether to automatically parse when setting a range value to a string value.void
setAutoRoundValue
(boolean value) Sets whether to round the number to 15 significant figures when getting the value.void
setCulture
(Locale value) Sets culture info for the workbook.void
setDefaultTableStyle
(String value) Sets the table style name from theITableStyleCollection
collectionthat is used as the default TableStyle.void
setDeferUpdateDirtyState
(boolean value) Sets whether update the dirty state of the formula cells immediately when changing the value of a cell.void
setEnableCalculation
(boolean value) Sets whether the calculation engine is valid.void
setGraphicsInfo
(IGraphicsInfo value) Provides graphics information.void
Sets a string value that represents the name of the workbook.void
Sets a string that represents the path to the workbook file that this workbook object represents.void
setReferenceStyle
(ReferenceStyle value) Sets the reference style.void
setResetAdjacentRangeBorder
(boolean value) Determines whether to reset adjacent range's border when setting border for a range.void
Sets the theme applied to the current workbook.toJson()
Generates a json string from a workbook.toJson
(SerializationOptions serializationOptions) Generates a json string from the workbook.void
toJson
(OutputStream stream) Generates a json stream from a workbook.void
toJson
(OutputStream stream, SerializationOptions serializationOptions) Generates a json stream from a workbook.void
Removes protection from the workbook.void
Removes protection from the workbook.void
updateExcelLink
(String name) Updates a excel link.void
updateExcelLink
(String name, IWorkbook sourceWorkbook) Updates a excel link.void
Updates all the excel links.
-
方法详细资料
-
getAllowDynamicArray
已过时。Gets whether allow dynamic array formula.This method is obsoleted, please use getFormula2() to get dynamic array formula. -
setAllowDynamicArray
已过时。Sets whether allow dynamic array formula.This method is obsoleted, please use setFormula2() to set dynamic array formula. -
getDeferUpdateDirtyState
boolean getDeferUpdateDirtyState()Gets whether update the dirty state of the formula cells immediately when changing the value of a cell. -
setDeferUpdateDirtyState
void setDeferUpdateDirtyState(boolean value) Sets whether update the dirty state of the formula cells immediately when changing the value of a cell. -
getName
String getName()Gets a string value that represents the name of the workbook. -
setName
Sets a string value that represents the name of the workbook. -
getFullName
String getFullName()Returns the name of the workbook, including its path on disk. -
getPath
String getPath()Gets a string that represents the path to the workbook file that this workbook object represents. -
setPath
Sets a string that represents the path to the workbook file that this workbook object represents. -
getSelectedSheets
IWorksheets getSelectedSheets()Returns aIWorksheets
collectionthat represents all the selected sheets in the specified workbook. -
getOptions
IExcelOptions getOptions()Returns theIExcelOptions
object that represents some settings to control workbook behavior. -
getResetAdjacentRangeBorder
boolean getResetAdjacentRangeBorder()Determines whether to reset adjacent range's border when setting border for a range. The default value of this property is true -
setResetAdjacentRangeBorder
void setResetAdjacentRangeBorder(boolean value) Determines whether to reset adjacent range's border when setting border for a range. The default value of this property is true- 参数:
value
-
-
getAutoParse
boolean getAutoParse()Gets whether to automatically parse when setting a range value to a string value. -
setAutoParse
void setAutoParse(boolean value) Sets whether to automatically parse when setting a range value to a string value. -
getAutoRoundValue
boolean getAutoRoundValue()Gets whether to round the number to 15 significant figures when getting the value. -
setAutoRoundValue
void setAutoRoundValue(boolean value) Sets whether to round the number to 15 significant figures when getting the value. -
getBookView
IWorkbookView getBookView()Returns an object that represents the view settings of this workbook. -
getProtectStructure
boolean getProtectStructure()True if the order of the sheets in the workbook is protected. Read-only Boolean. -
getProtectWindows
boolean getProtectWindows()True if the windows of the workbook are protected. Read-only Boolean. -
getSignatures
ISignatureSet getSignatures()Gets a collection of Signature objects that correspond to the digital signature attached to a document. -
getBuiltInDocumentProperties
IBuiltInDocumentPropertyCollection getBuiltInDocumentProperties()Gets a collection that represents all the built-in document properties of the workbook. -
getCustomDocumentProperties
ICustomDocumentPropertyCollection getCustomDocumentProperties()Gets a collection that represents all the custom document properties of the workbook. -
getCustomViews
ICustomViews getCustomViews()Gets the custom views of the workbook. -
getWriteProtection
WriteProtection getWriteProtection()Returns aWriteProtection
object that provides access to the workbook write protection options. -
getEnableCalculation
boolean getEnableCalculation()Gets whether the calculation engine is valid. -
setEnableCalculation
void setEnableCalculation(boolean value) Sets whether the calculation engine is valid. -
getCulture
Locale getCulture()Gets culture info for the workbook. Which influences the feature related culture. -
setCulture
Sets culture info for the workbook. Which influences the feature related culture. -
getDefaultTableStyle
String getDefaultTableStyle()Gets the table style name from theITableStyleCollection
collectionthat is used as the default TableStyle. -
setDefaultTableStyle
Sets the table style name from theITableStyleCollection
collectionthat is used as the default TableStyle. -
getNames
INames getNames()Returns theINames
collection that represents all the names in thespecified workbook (including all worksheet-specific names). -
getAuthor
String getAuthor()Gets the author. -
setAuthor
Sets the author. -
getPivotCaches
IPivotCaches getPivotCaches()Returns theIPivotCaches
collection that represents all theIPivotTable
caches in the specified workbook. -
getReferenceStyle
ReferenceStyle getReferenceStyle()Gets the reference style. -
setReferenceStyle
Sets the reference style. -
getStyles
IStyleCollection getStyles()Returns theIStyleCollection
collection that represents all thestyles in the specified workbook. -
getTableStyles
ITableStyleCollection getTableStyles()Returns theITableStyleCollection
collection object for the currentworkbook that refers to the styles used in the current workbook. -
getTheme
ITheme getTheme()Returns the theme applied to the current workbook. -
setTheme
Sets the theme applied to the current workbook. -
getIconSets
IIconSets getIconSets()Filters data in a workbook based on a cell icon from the IconSets collection. -
getWorksheets
IWorksheets getWorksheets()Returns theIWorksheets
collection that represents all the worksheetsin the specified workbook. This is a read-only Sheets object. -
getActiveSheet
IWorksheet getActiveSheet()Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns null if no sheet is active. -
getSlicerCaches
ISlicerCaches getSlicerCaches()Gets theISlicerCaches
object associated with the workbook. -
calculate
void calculate()Calculates formulas of the workbook as needed. -
dirty
void dirty()Designates all the formulas of the workbook to be recalculated when the next calculation occurs. -
toJson
String toJson()Generates a json string from a workbook.- 返回:
- the json string.
-
toJson
Generates a json string from the workbook.- 参数:
serializationOptions
- theSerializationOptions
object.- 返回:
- The json string
-
toJson
Generates a json stream from a workbook.- 参数:
stream
- the output stream.
-
toJson
Generates a json stream from a workbook.- 参数:
stream
- the output stream.serializationOptions
- theSerializationOptions
object.
-
isEncryptedFile
Specifies whether the file is password protected.- 参数:
fileName
- the file name.
-
isEncryptedFile
Specifies whether the file is password protected.- 参数:
fileStream
- the input file stream.
-
open
Opens the specified excel file- 参数:
fileName
- The excel file.
-
open
Opens the specified excel file- 参数:
fileName
- The excel file.password
- The password of the file.
-
open
Opens the file with specified options, the open options can be XlsxOpenOptions, CSVOpenOptions.- 参数:
fileName
- The excel file.options
- The options of opening the file.
-
open
Opens the specified format file.- 参数:
fileName
- The specified file.fileFormat
- The format of the file.
-
open
Opens the specified excel file stream.- 参数:
fileStream
- The file stream.
-
open
Opens the specified excel file stream.- 参数:
fileStream
- The file stream.password
- The password of the file.
-
open
Opens the stream with specified options, the open options can be XlsxOpenOptions, CsvOpenOptions.- 参数:
fileStream
- The file stream.options
- The format of opening the file stream.
-
open
Opens the specified format file stream.- 参数:
fileStream
- The specified file stream.fileFormat
- The format of the file stream.
-
save
Saves the workbook to the disk.- 参数:
fileName
- The file name.
-
save
Saves data to the specified excel file.- 参数:
fileName
- The excel file.password
- The password of the file.
-
save
Saves workbook to file with specified options. The option can be XlsxSaveOptions, CsvSaveOptions, HtmlSaveOptions- 参数:
fileName
- The specified file.options
- The options of saving the file.
-
save
Saves the specified format file.- 参数:
fileName
- The specified file.fileFormat
- The format of the file.
-
save
Saves the workbook to the stream.- 参数:
outputStream
- The file stream.
-
save
Saves data to the specified excel file stream.- 参数:
outputStream
- The file stream.password
- The password of the file.
-
save
Saves workbook to stream with specified options. The option can be XlsxSaveOptions, CsvSaveOptions, HtmlSaveOptions- 参数:
fileStream
- The specified file stream.options
- The options of saving the file stream.
-
save
Saves the specified format file stream.- 参数:
fileStream
- The specified file stream.fileFormat
- The format of the file stream.
-
protect
void protect()Protects a workbook so that it cannot be modified. -
protect
void protect(boolean structure) Protects a workbook so that it cannot be modified.- 参数:
structure
- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).
-
protect
void protect(boolean structure, boolean windows) Protects a workbook so that it cannot be modified.- 参数:
structure
- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).windows
- True to prevent users from moving, resizing, or closing the workbook window, or hide/unhide windows. This option is available only in Excel 2007, Excel 2010, Excel for Mac 2011, and Excel 2016 for Mac.
-
protect
Protects a workbook so that it cannot be modified.- 参数:
password
- Password to protect the workbook.
-
protect
Protects a workbook so that it cannot be modified.- 参数:
password
- Password to protect the workbook.structure
- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).
-
protect
Protects a workbook so that it cannot be modified.- 参数:
password
- Password to protect the workbook.structure
- True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).windows
- True to prevent users from moving, resizing, or closing the workbook window, or hide/unhide windows. This option is available only in Excel 2007, Excel 2010, Excel for Mac 2011, and Excel 2016 for Mac.
-
unprotect
void unprotect()Removes protection from the workbook. -
unprotect
Removes protection from the workbook.- 参数:
password
- Password to protect the workbook.
-
addDataSource
Add data source for template- 参数:
name
- : the alias name of the data sourcedataSource
- : Can be object of ResultSet, Custom object and variable
-
processTemplate
void processTemplate()Start to process the template -
generateReport
IWorkbook generateReport()Process the template and return the instance of report workbook.- 返回:
- The new
IWorkbook
object.
-
generateReport
Process the template and return the instance of report workbook.- 参数:
worksheets
- IWorksheet collection that need to be processed.- 返回:
- The new
IWorkbook
object.
-
getGraphicsInfo
IGraphicsInfo getGraphicsInfo()Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information. -
setGraphicsInfo
Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information. -
updateExcelLink
Updates a excel link. -
updateExcelLink
Updates a excel link. -
updateExcelLinks
void updateExcelLinks()Updates all the excel links.
-