![]() |
||
Home Products Purchase Downloads Demos Forums Blogs Ticket Wiki API Corporate |
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aspose.cells.Workbook
public class Workbook
Represents an Workbook Object.
Constructor Summary | |
---|---|
Workbook()
Constructs a workbook object using default settings. |
Method Summary | |
---|---|
void |
calculateFormula()
Calculates the result of formulas. |
void |
calculateFormula(boolean ignoreError)
Calculates the result of formulas. |
void |
calculateFormula(boolean ignoreError,
ICustomFunction customFunction)
Calculates the result of formulas. |
void |
combine(Workbook source)
Combines another Workbook object. |
void |
copy(Workbook source)
Copys contents and formats from another workbook. |
Worksheet |
createSheet()
Deprecated. Replaced by Worksheets.addSheet() . |
Worksheet |
createSheet(java.lang.String sheetName)
Deprecated. Replaced by Worksheets.addSheet(String) . |
Style |
createStyle()
Creates a new style. |
Worksheet |
getActiveSheet()
Deprecated. Replaced by Worksheets.getActiveSheet() . |
int |
getActiveSheetIndex()
Deprecated. Replaced by Worksheets.getActiveSheetIndex() . |
int |
getCalculationMode()
Returns the calculation mode. |
DataSorter |
getDataSorter()
Gets DataSorter Object |
Style |
getDefaultStyle()
Gets the default style of the workbook. |
int |
getFileFormatType()
Gets the file format type after this workbook opens data. |
short |
getLanguage()
Gets the user interface language of the Workbook version that has saved the file. |
Style |
getNamedStyle(java.lang.String styleName)
Gets a style by it's name. |
Style[] |
getNamedStyles()
Gets all named styles within the workbook. |
int |
getNumberOfSheets()
Deprecated. Replaced by Worksheets.size() . |
OpenOptions |
getOpenOptions()
Provides options to control how the workbook is opened. |
Palette |
getPalette()
Gets the palette of the workbook. |
short |
getRegion()
Gets the system regional settings at the time the file was saved. |
SaveOptions |
getSaveOptions()
Provides options to control how the workbook is saved. |
Worksheet |
getSheet(int index)
Deprecated. Replaced by Worksheets.getSheet(int) . |
Worksheet |
getSheet(java.lang.String name)
Deprecated. Replaced by Worksheets.getSheet(String) . |
int |
getSheetIndex(java.lang.String name)
Deprecated. Replaced by Worksheets.getSheetIndex(String) . |
java.lang.String |
getSheetName(int index)
Deprecated. Replaced by Worksheets.getSheetName(int) . |
Worksheets |
getWorksheets()
Gets the Worksheets collection in the spreadsheet. |
boolean |
hasMacro()
Indicates if this spreadsheet contains macro/VBA. |
int |
insertName(java.lang.String text,
java.lang.String refersTo)
Defines a new name. |
boolean |
isCalculateBeforeSave()
Whether workbooks are calculated before they're saved to disk (if the Calculation Mode is set to MANUAL). |
boolean |
isConvertNumericData()
Indicates if convert string in text file to numeric data. |
boolean |
isDate1904()
Indicates whether the workbook works with 1904 date system. |
boolean |
isHorizontalScrollBarHidden()
Checks if the horizontal scroll bar is hidden. |
boolean |
isProtected(byte protectionType)
Indicates if the workbook is protected or the file is protected. |
boolean |
isSheetTabBarHidden()
Checks if the sheet tab bar is hidden. |
boolean |
isVerticalScrollBarHidden()
Checks if the vertical scroll bar is hidden. |
boolean |
isWorkbookProtected()
Indicates if the workbook is protected. |
boolean |
isZS()
Indicates whether RC-style addresses is Z1S1 style. |
void |
loadData(java.io.InputStream stream)
Loads data from an Excel file. |
void |
loadData(java.io.InputStream stream,
java.lang.String password)
Loads data from an Excel file. |
void |
loadData(java.lang.String fileName)
Loads data from an Excel file. |
void |
loadData(java.lang.String fileName,
java.lang.String password)
Loads data from an Excel file. |
void |
moveSheet(int origin,
int dest)
Deprecated. Replaced by Worksheets.moveSheet(int,int) . |
void |
open(java.io.InputStream stream)
Opens an Workbook file from the given stream. |
void |
open(java.io.InputStream stream,
char separator,
boolean convertNumericData,
java.lang.String charsetName)
Opens text files with user defined separator. |
void |
open(java.io.InputStream stream,
int fileFormatType)
Opens an Workbook file from the given stream. |
void |
open(java.io.InputStream stream,
int fileFormatType,
java.lang.String password)
Opens an Workbook file from the given stream. |
void |
open(java.lang.String fileName)
Opens an Workbook file from disk. |
void |
open(java.lang.String fileName,
char separator,
boolean convertNumericData,
java.lang.String charsetName)
Opens text files with user defined separator. |
void |
open(java.lang.String fileName,
int fileFormatType)
Opens an Workbook file from disk. |
void |
open(java.lang.String fileName,
int fileFormatType,
java.lang.String password)
Opens an Workbook file from disk. |
void |
protectFile(byte protectionType,
java.lang.String password)
Protects a file. |
void |
protectWorkbook(byte protectionType,
java.lang.String password)
Protects a workbook. |
void |
read(java.io.InputStream stream)
Deprecated. Replaced by open(stream) . |
void |
read(java.lang.String fileName)
Deprecated. Replaced by open(fileName) . |
void |
removeSheet(int index)
Deprecated. Replaced by Worksheets.removeSheet(int) . |
boolean |
removeSheet(java.lang.String sheetName)
Deprecated. Replaced by Worksheets.removeSheet(String) . |
boolean |
removeSheet(Worksheet sheet)
Deprecated. Replaced by Worksheets.removeSheet(Worksheet) . |
void |
save(java.io.OutputStream stream)
Saves the workbook to the given stream. |
void |
save(java.io.OutputStream stream,
char separator,
java.lang.String charsetName)
Creates text files with user defined separator. |
void |
save(java.io.OutputStream stream,
int fileFormatType)
Saves the workbook to the given stream. |
void |
save(java.lang.String fileName)
Saves the workbook to a file. |
void |
save(java.lang.String fileName,
char separator,
java.lang.String charsetName)
Creates text files with user defined separator. |
void |
save(java.lang.String fileName,
int fileFormatType)
Saves the workbook to a file. |
void |
setCalculateBeforeSave(boolean calculateBeforeSave)
Sets whether workbooks are calculated before they're saved to disk. |
void |
setCalculationMode(int calculationMode)
Sets the calculation mode. |
void |
setConvertNumericData(boolean convertNumericData)
Indicates if convert string in text file to numeric data. |
void |
setDate1904(boolean isDate1904)
Sets whether the workbook works with 1904 date system. |
void |
setEncryptionOption(byte encryptionType,
int keyLength)
Sets Encryption Options. |
void |
setFileFormatType(int fileFormatType)
Sets the file format type for this workbook. |
void |
setHorizontalScrollBarHidden(boolean isHidden)
Sets the horizontal scroll bar to be hidden or not. |
void |
setIsZS(boolean isZS)
Indicates whether RC-style addresses is Z1S1 style. |
void |
setLanguage(short countryCode)
Sets the user interface language of the Workbook version that has saved the file. |
void |
setLocale(java.util.Locale locale)
Sets locale region at the time the file was saved. |
void |
setOleSize(int startRow,
int endRow,
int startColumn,
int endColumn)
Sets displayed size when Workbook file is used as an Ole object. |
void |
setProtectedBy(java.lang.String user)
Sets the user who reserved this workbook by protect file with type ProtectionType.MODIFY_FILE |
void |
setRegion(short countryCode)
Sets the system regional settings at the time the file was saved. |
void |
setSheetTabBarHidden(boolean isHidden)
Sets the sheet tab bar to be hidden or not. |
void |
setVerticalScrollBarHidden(boolean isHidden)
Sets the vertical scroll bar to be hidden or not. |
void |
swapSheet(int idx1,
int idx2)
Deprecated. Replaced by Worksheets.swapSheet(int,int) . |
void |
unprotectWorkbook(java.lang.String password)
Unprotects a workbook. |
void |
write(java.io.OutputStream stream)
Deprecated. Replaced by save(stream) . |
void |
write(java.io.OutputStream stream,
int fileFormatType)
Deprecated. Replaced by save(stream,fileFormatType) . |
void |
write(java.lang.String fileName)
Deprecated. Replaced by save(fileName) . |
void |
write(java.lang.String fileName,
int fileFormatType)
Deprecated. Replaced by save(fileName,fileFormatType) . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Workbook()
Method Detail |
---|
public short getLanguage()
CountryCode
public void setLanguage(short countryCode)
countryCode
- the user interface language of the Workbook version that has saved
the file.CountryCode
public short getRegion()
CountryCode
public void setRegion(short countryCode)
countryCode
- the system regional settings at the time the file was saved.CountryCode
public void setLocale(java.util.Locale locale)
locale
- the Locale object.public boolean isZS()
public void setIsZS(boolean isZS)
isZS
- whether RC-style addresses is Z1S1 style.public void copy(Workbook source)
source
- the source workbook.public void combine(Workbook source)
source
- The Workbook object to be combined into this one.public int getFileFormatType()
FileFormatType.UNKNOWN
public void setFileFormatType(int fileFormatType)
fileFormatType
- the file format type of this workbook.public SaveOptions getSaveOptions()
public OpenOptions getOpenOptions()
public void open(java.io.InputStream stream) throws java.io.IOException
stream
- the stream to read from.
java.io.IOException
- if an I/O error occurs.public void open(java.lang.String fileName) throws java.io.IOException
fileName
- the system-dependent file name.
java.io.IOException
- if an error occurs.public void open(java.io.InputStream stream, int fileFormatType) throws java.io.IOException
stream
- the stream to read from.fileFormatType
- one of the FileFormatType values whcih specifies the file format.
java.io.IOException
- if an I/O error occurs.public void open(java.io.InputStream stream, int fileFormatType, java.lang.String password) throws java.io.IOException
stream
- the stream to read from.fileFormatType
- one of the FileFormatType values whcih specifies the file format.password
- file encryption password.
java.io.IOException
- if an I/O error occurs.public void open(java.lang.String fileName, int fileFormatType, java.lang.String password) throws java.io.IOException
fileName
- the system-dependent file name.fileFormatType
- one of the FileFormatType values whcih specifies the file format.password
- file encryption password.
java.io.IOException
- if an error occurs.public void open(java.lang.String fileName, int fileFormatType) throws java.io.IOException
fileName
- the system-dependent file name.fileFormatType
- one of the FileFormatType values whcih specifies the file format.
java.io.IOException
- if an error occurs.public void open(java.lang.String fileName, char separator, boolean convertNumericData, java.lang.String charsetName) throws java.io.IOException
fileName
- Text file name.separator
- Delimiter of text file.convertNumericData
- Indicates if convert string in text file to numeric data.charsetName
- The name of a charset,Null : default charset.
java.io.IOException
- if an I/O error occurs.public void open(java.io.InputStream stream, char separator, boolean convertNumericData, java.lang.String charsetName) throws java.io.IOException
stream
- The stream to read from.separator
- Delimiter of text file.convertNumericData
- Indicates if convert string in text file to numeric data.charsetName
- the name of a charset,Null : default charset.
java.io.IOException
- if an I/O error occurs.public void loadData(java.lang.String fileName) throws java.io.IOException
open(String)
method, so it's better to be used for applications
which only need to process data in Excel file.
fileName
- Name of imported Excel file.
java.io.IOException
public void loadData(java.lang.String fileName, java.lang.String password) throws java.io.IOException
open(String)
method, so it's better to be used for applications
which only need to process data in Excel file.
fileName
- Name of imported Excel file.password
- file encryption password.
java.io.IOException
public void loadData(java.io.InputStream stream, java.lang.String password) throws java.io.IOException
open(InputStream)
method, so it's better to be used for
applications which only need to process data in Excel file.
stream
- the stream to read from.password
- file encryption password.
java.io.IOException
public void loadData(java.io.InputStream stream) throws java.io.IOException
open(InputStream)
method, so it's better to be used for
applications which only need to process data in Excel file.
stream
- the stream to read from.
java.io.IOException
public void save(java.io.OutputStream stream) throws java.io.IOException
setFileFormatType(int)
or by openning a template file),
then save as the specified file format. Otherwise save as FileFormatType.EXCEL97TO2003
.
stream
- the stream to write to.
java.io.IOException
- if an I/O error occurs.public void save(java.io.OutputStream stream, int fileFormatType) throws java.io.IOException
stream
- the stream to write to.fileFormatType
- one of the FileFormatType values whcih specifies the file format.
java.io.IOException
- if an I/O error occurs.public void save(java.lang.String fileName) throws java.io.IOException
setFileFormatType(int)
or by openning a template file),
then save as the specified file format.
Otherwise a file format type that matchs given file name will be used to save this workbook.
fileName
- the system-dependent file name.
java.io.IOException
- if an I/O error occurs.public void save(java.lang.String fileName, int fileFormatType) throws java.io.IOException
fileName
- the system-dependent file name.fileFormatType
- one of the FileFormatType values whcih specifies the file format.
java.io.IOException
- if an I/O error occurs.FileFormatType
public void save(java.lang.String fileName, char separator, java.lang.String charsetName) throws java.io.IOException
fileName
- Text file name.separator
- Delimiter of text file.charsetName
- the name of a charset.
java.io.IOException
- if an I/O error occurs.public void save(java.io.OutputStream stream, char separator, java.lang.String charsetName) throws java.io.IOException
stream
- The stream to write to.separator
- Delimiter of text file.charsetName
- the name of a charset.
java.io.IOException
- if an I/O error occurs.public Worksheets getWorksheets()
public Style getDefaultStyle()
public Style createStyle()
public Style getNamedStyle(java.lang.String styleName)
styleName
- name of the style.
public Style[] getNamedStyles()
public boolean isHorizontalScrollBarHidden()
public boolean isVerticalScrollBarHidden()
public boolean isSheetTabBarHidden()
public void setHorizontalScrollBarHidden(boolean isHidden)
isHidden
- true for hidden; false otherwise.public void setVerticalScrollBarHidden(boolean isHidden)
isHidden
- true for hidden; false otherwise.public void setSheetTabBarHidden(boolean isHidden)
isHidden
- true for hidden; false otherwise.public Palette getPalette()
public boolean isCalculateBeforeSave()
public void setCalculateBeforeSave(boolean calculateBeforeSave)
calculateBeforeSave
- whether workbooks are calculated before they're saved to disk.public int getCalculationMode()
setCalculationMode(int)
public void setCalculationMode(int calculationMode)
calculationMode
- calculation mode.It could be one of the following values: CalculationMode.AUTOMATIC |
CalculationMode.SEMIAUTOMATIC |
CalculationMode.MANUAL |
java.lang.IllegalArgumentException
- if calculation mode is invalid.public boolean isConvertNumericData()
public void setConvertNumericData(boolean convertNumericData)
convertNumericData
- if convert string in text file to numeric data.public boolean hasMacro()
public void protectFile(byte protectionType, java.lang.String password)
protectionType
- protection type.It could be one of the following values: ProtectionType.OPEN_FILE |
ProtectionType.MODIFY_FILE |
password
- password to protect the file. if password is null, it means
unprotecting file.
CellsException
- if workbook is already protected.public void setProtectedBy(java.lang.String user)
user
- the user name.public void setEncryptionOption(byte encryptionType, int keyLength)
encryptionType
- the encryption type. It could be one of the following values:
EncryptionType.STONG_CRYPTOGRAPHIC_PROVIDER |
EncryptionType.XOR |
keyLength
- the key length.public boolean isProtected(byte protectionType)
public void protectWorkbook(byte protectionType, java.lang.String password)
protectionType
- protection type.It could be one of the following values: ProtectionType.WORKBOOK_ALL |
ProtectionType.STRUCTURE |
ProtectionType.WINDOWS |
password
- password to protect the workbook.
CellsException
- if workbook is already protected.public void unprotectWorkbook(java.lang.String password)
password
- password to unprotect the workbook.
CellsException
- if password is invalid.public boolean isWorkbookProtected()
public boolean isDate1904()
public void setDate1904(boolean isDate1904)
isDate1904
- whether the workbook works with 1904 date system.public void setOleSize(int startRow, int endRow, int startColumn, int endColumn)
startRow
- start row indexendRow
- end row indexstartColumn
- start column indexendColumn
- end column indexpublic void calculateFormula()
CellsException
- if the cell has been removed from the worksheet.public void calculateFormula(boolean ignoreError, ICustomFunction customFunction) throws FormulaCalcException
ignoreError
- Indicates if hide the error in calculating formulas. The error may
be unsupported function, external links, etc.customFunction
- Custom function interface to extend formula calculation engine.
FormulaCalcException
- if an error occurs and not hide the error.public void calculateFormula(boolean ignoreError) throws FormulaCalcException
ignoreError
- Indicates if hide the error in calculating formulas. The error may
be unsupported function, external links, etc.
FormulaCalcException
- if an error occurs and not hide the error.calculateFormula()
public int insertName(java.lang.String text, java.lang.String refersTo) throws java.io.UnsupportedEncodingException
text
- the name text of the user-defined name.refersTo
- the formula that the name is defined to refer to, beginning with
an equal sign.
java.lang.IllegalArgumentException
- if refersTo is null or formulas in the refersTo are unspported.
java.io.UnsupportedEncodingException
- if text contains unsupported encoding.@Deprecated public void read(java.io.InputStream stream) throws java.io.IOException
open(stream)
.
stream
- the stream to read from.
java.io.IOException
- if an I/O error occurs.@Deprecated public void read(java.lang.String fileName) throws java.io.IOException
open(fileName)
.
fileName
- the system-dependent file name.
java.io.IOException
- if an error occurs.@Deprecated public void write(java.io.OutputStream stream) throws java.io.IOException
save(stream)
.
stream
- the stream to write to.
java.io.IOException
- if an I/O error occurs.@Deprecated public void write(java.io.OutputStream stream, int fileFormatType) throws java.io.IOException
save(stream,fileFormatType)
.
stream
- the stream to write to.fileFormatType
- one of the FileFormatType values whcih specifies the file format.
java.io.IOException
- if an I/O error occurs.@Deprecated public void write(java.lang.String fileName) throws java.io.IOException
save(fileName)
.
fileName
- the system-dependent file name.
java.io.IOException
- if an I/O error occurs.@Deprecated public void write(java.lang.String fileName, int fileFormatType) throws java.io.IOException
save(fileName,fileFormatType)
.
fileName
- the system-dependent file name.fileFormatType
- one of the FileFormatType values whcih specifies the file format.
java.io.IOException
- if an I/O error occurs.FileFormatType
@Deprecated public int getNumberOfSheets()
Worksheets.size()
.
@Deprecated public Worksheet getSheet(int index)
Worksheets.getSheet(int)
.
index
- index of the sheet.
java.lang.IllegalArgumentException
- if the index is out of range.@Deprecated public Worksheet getSheet(java.lang.String name)
Worksheets.getSheet(String)
.
name
- name of the sheet.
@Deprecated public int getSheetIndex(java.lang.String name)
Worksheets.getSheetIndex(String)
.
name
- name of the sheet.
@Deprecated public java.lang.String getSheetName(int index)
Worksheets.getSheetName(int)
.
index
- index of the sheet.
java.lang.IllegalArgumentException
- if the index is out of range.@Deprecated public Worksheet createSheet()
Worksheets.addSheet()
.
@Deprecated public Worksheet createSheet(java.lang.String sheetName)
Worksheets.addSheet(String)
.
sheetName
- name of the worksheet.
@Deprecated public void swapSheet(int idx1, int idx2)
Worksheets.swapSheet(int,int)
.
idx1
- index of the first sheetidx2
- index of the second sheet
java.lang.IllegalArgumentException
- if any of the positions is out of range.@Deprecated public void moveSheet(int origin, int dest)
Worksheets.moveSheet(int,int)
.
origin
- the original index of the sheet.dest
- the new index of the sheet.
java.lang.IllegalArgumentException
- if any of the indexes is out of range.@Deprecated public void removeSheet(int index)
Worksheets.removeSheet(int)
.
index
- index of the sheet.
java.lang.IllegalArgumentException
- if index is out of range.@Deprecated public boolean removeSheet(Worksheet sheet)
Worksheets.removeSheet(Worksheet)
.
sheet
- the sheet to remove.
@Deprecated public boolean removeSheet(java.lang.String sheetName)
Worksheets.removeSheet(String)
.
sheetName
- name of the sheet to remove
@Deprecated public int getActiveSheetIndex()
Worksheets.getActiveSheetIndex()
.
@Deprecated public Worksheet getActiveSheet()
Worksheets.getActiveSheet()
.
public DataSorter getDataSorter()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |