|
|||||||||
prev class next class | frames no frames | ||||||||
summary: nested | field | constr | method | detail: field | constr | method |
java.lang.objectcom.spire.xls.workbook
public final class workbook
represents the workbook object of excel.
constructor summary | |
---|---|
workbook()
create a new instance of workbook. |
method summary | |
---|---|
void |
addpivottablestyle(pivottablestyle pts)
|
static boolean |
bookispasswordprotected(java.lang.string filename)
check if the file is password protected. |
void |
calculateallvalue()
caculate all formula for the workbook |
java.lang.object |
calculateformulavalue(java.lang.string text)
calculates the string formula |
void |
changepalettecolor(java.awt.color color,
int index)
changes the palette for the spreadsheet in the specified index. |
double |
columnwidthtopixels(double columnwidth)
onverts column width in characters into column width in pixels. |
boolean |
containsfont(excelfont font)
indicates whether the workbook contains specified font. |
void |
copytoclipboard()
copies whole workbook to the clipboard. |
void |
copytoclipboard(worksheet worksheet)
copies the selected worksheet to clipboard. |
worksheet |
createemptysheet()
create a new worksheet. |
worksheet |
createemptysheet(java.lang.string name)
create a new worksheet. |
void |
createemptysheets(int sheetcount)
create workbook with specified number of worksheets. |
void |
createemptysheets(java.lang.string[] sheetnames)
create workbook with specified names of worksheets. |
excelfont |
createfont()
creates a font object and adds it to the workbook. |
excelfont |
createfont(java.awt.font font)
creates a font object and add it to the workbook. |
pivotstyle |
createpivotstyle()
|
void |
dispose()
|
cellrange[] |
findallbool(boolean boolvalue)
finds the cell with the input bool. |
cellrange[] |
findalldatetime(java.util.date datetimevalue)
finds the cell with the input datetime. |
cellrange[] |
findallnumber(double doublevalue,
boolean formulavalue)
finds the cell with the input double. |
cellrange[] |
findallstring(java.lang.string stringvalue,
boolean formula,
boolean formulavalue)
finds the cell with the input string. |
cellrange |
findbool(boolean boolvalue)
finds the cell with the input bool. |
cellrange |
finddatetime(java.util.date datetimevalue)
finds the cell with the input datetime. |
cellrange |
findnumber(double doublevalue,
boolean formulavalue)
finds the cell with the input number. |
cellrange |
findstring(java.lang.string stringvalue,
boolean formula,
boolean formulavalue)
finds the cell with the input string. |
worksheet |
getactivesheet()
returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. |
int |
getactivesheetindex()
gets index of the active worksheet. |
addinfunctionscollection |
getaddinfunctions()
returns collection of add-in functions. |
boolean |
getallow3drangesindatavalidation()
indicates whether to allow usage of 3d ranges in datavalidation list property (ms excel doesn't allow). |
excelcalculationmode |
getcalculationmode()
get calculation mode. |
chartscollection |
getcharts()
returns a sheets collection that represents all the chart sheets in the specified workbook. |
chartsheet |
getchartsheetbyname(java.lang.string name)
|
java.util.arraylist |
getchartsheets()
|
java.lang.string |
getcodename()
name which used by macros to access to workbook items. |
java.awt.color[] |
getcolors()
returns colors in the palette for the workbook. |
convertersetting |
getconvertersetting()
get converter setting |
icustomdocumentproperties |
getcustomdocumentproperties()
returns collection that represents all the custom document properties for the specified workbook. |
java.lang.string[] |
getcustomfontfilepaths()
returns the custom path of font files. |
java.util.hashtable |
getcustomfontparsedresult()
get result that parse the custom path of font files |
java.util.hashtable |
getcustomtablestyles()
|
datasorter |
getdatasorter()
gets data sorter to sort the data. |
boolean |
getdate1904()
true if the workbook uses the 1904 date system. |
java.nio.charset.charset |
getdefaultcharset()
default charset = utf-8 |
java.lang.string |
getdefaultfontname()
returns the name of the default font. |
double |
getdefaultfontsize()
returns the default font size. |
boolean |
getdisablemacrosstart()
allows users to disable load of macros from document. |
builtindocumentproperties |
getdocumentproperties()
returns a builtindocumentproperties collection that represents all the built-in document properties for the specified workbook. |
java.lang.string |
getfilename()
gets file name. |
markerdesigner |
getmarkerdesigner()
|
excelcolors |
getmatchingcolor(java.awt.color color)
find best matching color in workbook palette. |
excelcolors |
getmatchingcolor(int r,
int g,
int b)
find best matching color in workbook palette. |
int |
getmaxdigitwidth()
|
inameranges |
getnameranges()
gets names collection that represents all the names in the specified workbook |
ixlsrange |
getolesize()
get the size of the visible range of cells when this workbook is displyed as an embedded obect in another document; |
java.lang.string |
getopenpassword()
returns password to encrypt document. |
boolean |
getoptimizeimport()
indicates whether to optimize import data. |
java.awt.color |
getpalettecolor(excelcolors color)
gets excel color from workbook palette. |
pivotcachescollection |
getpivotcaches()
|
boolean |
getprintusingimagemode()
get print by using image mode |
boolean |
getreadonly()
indicates whether the workbook has been opened as read-only. |
int |
getselectedtab()
gets tab index of selected. |
boolean |
getshowtabs()
gets a value whether the workbook tabs are displayed. |
java.util.list |
getsplitpageinfo()
|
datatable |
getsplitpagetable(workbook wb)
|
stylescollection |
getstyles()
returns a styles collection that represents all the styles in the specified workbook. |
excelversion |
getversion()
|
worksheetscollection |
getworksheets()
returns a sheets collection that represents all the worksheets in the specified workbook. |
boolean |
hasmacros()
indicates whether contains vba macros. |
void |
hasmacros(boolean value)
sets whether contains vba macros. |
void |
initcalcengine()
initilize calc engine |
boolean |
iscellprotection()
indicates whether cells are protected. |
boolean |
isrighttoleft()
indicates whether worksheet is displayed right to left. |
void |
isrighttoleft(boolean value)
indicates whether worksheet is displayed right to left. |
boolean |
issaved()
indicates whether workbook changes have been saved. |
boolean |
iswindowprotection()
indicates window is protected. |
void |
loadfromfile(java.lang.string filename)
loads a file and imports its data. |
void |
loadfromfile(java.lang.string filename,
boolean preservemode)
loads a file and imports its data. |
void |
loadfromfile(java.lang.string filename,
excelversion version)
loads a file and imports its data. |
void |
loadfromfile(java.lang.string filename,
java.lang.string separator)
loads text files stream with user defined separator. |
void |
loadfromfile(java.lang.string filename,
java.lang.string separator,
int row,
int column)
loads text files with user defined separator. |
void |
loadfromfile(java.lang.string filename,
java.lang.string separator,
int row,
int column,
excelversion version)
loads text files with user defined separator. |
void |
loadfromhtml(java.io.inputstream stream)
loads a html file and imports its data. |
void |
loadfromhtml(java.lang.string filename)
loads a html file and imports its data. |
void |
loadfrommhtml(java.io.inputstream stream)
loads a mhtml file and imports its data. |
void |
loadfrommhtml(java.lang.string filename)
loads a mhtml file and imports its data. |
void |
loadfromstream(java.io.inputstream stream)
loads workbook from the stream. |
void |
loadfromstream(java.io.inputstream stream,
boolean loadstyles)
load workbook from the stream. |
void |
loadfromstream(java.io.inputstream stream,
excelversion version)
load workbook from the stream. |
void |
loadfromstream(java.io.inputstream stream,
java.lang.string separator,
int row,
int column)
loads text files stream with user defined separator.max row 60000. |
void |
loadfromstream(java.io.inputstream stream,
java.lang.string separator,
int row,
int column,
excelversion version)
loads text files stream with user defined separator. |
void |
loadfromxml(java.io.inputstream stream)
loads a xml file and imports its data. |
void |
loadfromxml(java.lang.string filename)
loads a xml file and imports its data. |
void |
pastefromclipboard()
copies workbook and all its worksheets from the clipboard. |
double |
pixelstocolumnwidth(double pixels)
converts column width in pixels into column width in characters. |
void |
protect(java.lang.string passwordtoopen)
protects file, also protects workbook window and structure. |
void |
protect(java.lang.string passwordtoopen,
boolean bisprotectwindow,
boolean bisprotectcontent)
protects file,also indicates whether protects workbook window and structure or not |
void |
protectworkbook(boolean bisprotectwindow,
boolean bisprotectcontent,
java.lang.string password)
sets protection for workbook. |
void |
replace(java.lang.string oldvalue,
datacolumn newvalues,
boolean includecolumnname)
replaces cell's value from data column values. |
void |
replace(java.lang.string oldvalue,
datatable newvalues,
boolean includecolumnname)
replaces cell's value from data table values. |
void |
replace(java.lang.string oldvalue,
java.util.date newvalue)
replaces cell's value by specified value. |
void |
replace(java.lang.string oldvalue,
double newvalue)
replaces cell's value by specified value. |
void |
replace(java.lang.string oldvalue,
double[] newvalues,
boolean isvertical)
replaces cell's value from array. |
void |
replace(java.lang.string oldvalue,
int[] newvalues,
boolean isvertical)
replaces cell's value from array. |
void |
replace(java.lang.string oldvalue,
java.lang.string newvalue)
replaces cell's value by specified value. |
void |
replace(java.lang.string oldvalue,
java.lang.string[] newvalues,
boolean isvertical)
replaces cell's value from array. |
void |
resetpalette()
resets the color palette to the default colors. |
boolean |
retainhiddendatatocsv()
gets retain hidden data. |
void |
retainhiddendatatocsv(boolean value)
sets retain hidden data. |
void |
save()
saves changes to the specified workbook |
java.awt.image.bufferedimage[] |
saveasimage(float dpix,
float dpiy)
save workbook to image. |
java.awt.image.bufferedimage |
saveasimage(int sheetindex,
float dpix,
float dpiy)
save workbook to image. |
void |
saveastemplate(java.lang.string filename)
save workbook as template to file. |
void |
saveasxml(java.io.inputstream stream)
save workbook as xml format to stream. |
void |
saveasxml(java.lang.string filename)
save workbook to an xml data file. |
java.awt.image.bufferedimage |
savechartasimage(chartsheet chartsheet)
save chart to image. |
java.awt.image.bufferedimage[] |
savechartasimage(worksheet worksheet)
save chart to images. |
java.awt.image.bufferedimage |
savechartasimage(worksheet worksheet,
int chartindex)
saves chart to image. |
void |
savetofile(java.lang.string filename)
saves changes to the workbook in a different file |
void |
savetofile(java.lang.string filename,
excelversion version)
saves changes to the workbook in a different file |
void |
savetofile(java.lang.string filename,
fileformat fileformat)
saves changes to the workbook in a different file |
void |
savetofile(java.lang.string filename,
java.lang.string separator)
saves changes to the workbook in a different file |
void |
savetostream(java.io.outputstream stream)
saves workbook the stream |
void |
savetostream(java.io.outputstream stream,
fileformat fileformat)
saves workbook to stream. |
void |
savetostream(java.io.outputstream stream,
java.lang.string separator)
save workbook the stream. |
void |
setactivesheetindex(int value)
sets index of the active worksheet. |
void |
setallow3drangesindatavalidation(boolean value)
indicates whether to allow usage of 3d ranges in datavalidation list property (ms excel doesn't allow). |
void |
setcalculationmode(excelcalculationmode value)
set calculation mode. |
void |
setcodename(java.lang.string value)
name which used by macros to access to workbook items. |
void |
setconvertersetting(convertersetting value)
|
void |
setcustomfontfilepaths(java.lang.string[] value)
sets the custom path of font files. |
void |
setdate1904(boolean value)
set if the workbook uses the 1904 date system. |
void |
setdefaultcharset(java.nio.charset.charset defaultcharset)
|
void |
setdefaultfontname(java.lang.string value)
sets the name of the default font. |
void |
setdefaultfontsize(double value)
sets the default font size. |
void |
setdisablemacrosstart(boolean value)
allows users to disable load of macros from document. |
void |
setmaxdigitwidth(int w)
|
void |
setolesize(int firstrow,
int firstcolumn,
int lastrow,
int lastcolumn)
set the size of the visible range of cells when this workbook is displyed as an embedded obect in another document; |
void |
setopenpassword(java.lang.string openpassword)
sets password to encrypt document. |
void |
setoptimizeimport(boolean value)
indicates whether to optimize import data. |
void |
setprintusingimagemode(boolean usingimagemode)
set print by using image mode |
void |
setselectedtab(int value)
sets tab index of selected. |
void |
setshowtabs(boolean value)
sets a value whether the workbook tabs are displayed. |
void |
setversion(excelversion version)
|
void |
setwriteprotectionpassword(java.lang.string password)
sets write protection password. |
void |
unprotect()
unprotects file also upprotect workbook window and structure |
void |
unprotect(java.lang.string bookwindowandstructurepassword)
unprotect file also upprotect workbook window and structure |
void |
unprotectworkbook(java.lang.string password)
unprotect workbook window and structure |
constructor detail |
---|
public workbook()
method detail |
---|
public worksheetscollection getworksheets()
public inameranges getnameranges()
public worksheet getactivesheet()
public boolean getallow3drangesindatavalidation()
public void setallow3drangesindatavalidation(boolean value)
value
- public int getactivesheetindex()
public void setactivesheetindex(int value)
value
- public addinfunctionscollection getaddinfunctions()
public excelcalculationmode getcalculationmode()
public void setcalculationmode(excelcalculationmode value)
value
- public datasorter getdatasorter()
public java.lang.string getcodename()
public void setcodename(java.lang.string value)
public java.awt.color[] getcolors()
public convertersetting getconvertersetting()
public void setconvertersetting(convertersetting value)
public boolean getdate1904()
public void setdate1904(boolean value)
value
- public java.lang.string getdefaultfontname()
public void setdefaultfontname(java.lang.string value)
value
- public double getdefaultfontsize()
public void setdefaultfontsize(double value)
value
- public java.lang.string[] getcustomfontfilepaths()
public void setcustomfontfilepaths(java.lang.string[] value)
value
- public java.util.hashtable getcustomfontparsedresult()
public boolean getdisablemacrosstart()
public void setdisablemacrosstart(boolean value)
value
- public java.lang.string getfilename()
public boolean hasmacros()
public void hasmacros(boolean value)
value
- public boolean iscellprotection()
public boolean isrighttoleft()
public void isrighttoleft(boolean value)
public boolean issaved()
public boolean iswindowprotection()
public markerdesigner getmarkerdesigner()
public int getmaxdigitwidth()
public java.lang.string getopenpassword()
public void setopenpassword(java.lang.string openpassword)
openpassword
- public boolean getoptimizeimport()
public void setoptimizeimport(boolean value)
public pivotcachescollection getpivotcaches()
public boolean getreadonly()
public int getselectedtab()
public void setselectedtab(int value)
value
- public boolean getshowtabs()
public void setshowtabs(boolean value)
value
- public stylescollection getstyles()
public excelversion getversion()
public void setversion(excelversion version)
public chartscollection getcharts()
public java.util.arraylist getchartsheets()
public icustomdocumentproperties getcustomdocumentproperties()
public java.util.hashtable getcustomtablestyles()
public builtindocumentproperties getdocumentproperties()
public void loadfromfile(java.lang.string filename)
filename
- file name.public void loadfromfile(java.lang.string filename, boolean preservemode)
filename
- file namepreservemode
- preserve modepublic void loadfromfile(java.lang.string filename, excelversion version)
filename
- file nameversion
- excel versionpublic void loadfromfile(java.lang.string filename, java.lang.string separator)
filename
- file nameseparator
- delimiter of text file.public void loadfromfile(java.lang.string filename, java.lang.string separator, int row, int column)
filename
- file name.separator
- delimiter of text file.row
- start row.column
- start column.public void loadfromfile(java.lang.string filename, java.lang.string separator, int row, int column, excelversion version)
filename
- file name.separator
- delimiter of text file.row
- start row.column
- start column.version
- workbook versionpublic void loadfromstream(java.io.inputstream stream)
stream
- stream contains data.public void loadfromstream(java.io.inputstream stream, boolean loadstyles)
stream
- stream contains data.loadstyles
- indicates whether loads styles.public void loadfromstream(java.io.inputstream stream, excelversion version)
stream
- stream contains dataversion
- excel versionpublic void loadfromstream(java.io.inputstream stream, java.lang.string separator, int row, int column)
stream
- file stream.separator
- delimiter of text file.row
- start row.column
- start column.public void loadfromstream(java.io.inputstream stream, java.lang.string separator, int row, int column, excelversion version)
stream
- file stream.separator
- delimiter of text file.row
- start row.column
- start column.version
- excel version.public void loadfromxml(java.lang.string filename)
filename
- file name.public void loadfromxml(java.io.inputstream stream)
stream
- stream contains data.public void loadfromhtml(java.lang.string filename)
filename
- file name.public void loadfromhtml(java.io.inputstream stream)
stream
- stream contains data.public void loadfrommhtml(java.lang.string filename)
filename
- file name.public void loadfrommhtml(java.io.inputstream stream)
stream
- stream contains data.public void savetofile(java.lang.string filename)
filename
- file name.public void savetofile(java.lang.string filename, fileformat fileformat)
filename
- file namefileformat
- file formatpublic void savetofile(java.lang.string filename, java.lang.string separator)
filename
- file name.separator
- public boolean retainhiddendatatocsv()
public void retainhiddendatatocsv(boolean value)
value
- public void dispose()
public void savetofile(java.lang.string filename, excelversion version)
filename
- file nameversion
- excel versionpublic void addpivottablestyle(pivottablestyle pts)
public java.lang.object calculateformulavalue(java.lang.string text)
text
-
public void calculateallvalue()
public void changepalettecolor(java.awt.color color, int index)
color
- color structureindex
- palette index,value should be from 0 to 55public double columnwidthtopixels(double columnwidth)
columnwidth
- column width in characters.
public boolean containsfont(excelfont font)
font
-
public void copytoclipboard()
public void copytoclipboard(worksheet worksheet)
worksheet
- public worksheet createemptysheet()
public worksheet createemptysheet(java.lang.string name)
name
- sheet name.
public void createemptysheets(int sheetcount)
sheetcount
- public void createemptysheets(java.lang.string[] sheetnames)
sheetnames
- public excelfont createfont()
public excelfont createfont(java.awt.font font)
font
- font to add
public pivotstyle createpivotstyle()
public cellrange[] findallbool(boolean boolvalue)
boolvalue
- bool value to search for
public cellrange[] findallnumber(double doublevalue, boolean formulavalue)
doublevalue
- double value to search for.formulavalue
- indicates whether includes formula value to search for.
public cellrange[] findallstring(java.lang.string stringvalue, boolean formula, boolean formulavalue)
stringvalue
- string value to search forformula
- indicates whether includes formula to search for.formulavalue
- indicates whether includes formula value to search for.
public cellrange[] findalldatetime(java.util.date datetimevalue)
datetimevalue
-
public cellrange findbool(boolean boolvalue)
boolvalue
- bool value to search for.
public cellrange findnumber(double doublevalue, boolean formulavalue)
doublevalue
- double value to search for.formulavalue
- indicates whether includes formula value to search for.
public cellrange findstring(java.lang.string stringvalue, boolean formula, boolean formulavalue)
stringvalue
- string value to search for.formula
- indicates whether includes formula to search for.formulavalue
- indicates whether includes formula value to search for.
public cellrange finddatetime(java.util.date datetimevalue)
datetimevalue
- datetime value to search for.
public excelcolors getmatchingcolor(java.awt.color color)
color
- color to search for.
public excelcolors getmatchingcolor(int r, int g, int b)
r
- red color.g
- green color.b
- blue color.
public java.awt.color getpalettecolor(excelcolors color)
color
- index from palette array.
public java.util.listpagecolrow>> getsplitpageinfo()
public datatable getsplitpagetable(workbook wb)
public void initcalcengine()
public static boolean bookispasswordprotected(java.lang.string filename)
filename
-
public void pastefromclipboard()
public double pixelstocolumnwidth(double pixels)
pixels
- column width in pixels.
public void protect(java.lang.string passwordtoopen)
passwordtoopen
- password to open file.public void protect(java.lang.string passwordtoopen, boolean bisprotectwindow, boolean bisprotectcontent)
passwordtoopen
- password to open file.bisprotectwindow
- indicates if protect workbook window.bisprotectcontent
- indicates if protect workbook content.public void protectworkbook(boolean bisprotectwindow, boolean bisprotectcontent, java.lang.string password)
bisprotectwindow
- indicates if protect workbook window.bisprotectcontent
- indicates if protect workbook content.password
- passwordpublic void replace(java.lang.string oldvalue, datacolumn newvalues, boolean includecolumnname)
oldvalue
- value to replace.newvalues
- new data.includecolumnname
- indicates whether includes column name.public void replace(java.lang.string oldvalue, datatable newvalues, boolean includecolumnname)
oldvalue
- value to replace.newvalues
- new data.includecolumnname
- indicates whether includes column name.public void replace(java.lang.string oldvalue, java.util.date newvalue)
oldvalue
- value to replace.newvalue
- new valuepublic void replace(java.lang.string oldvalue, double newvalue)
oldvalue
- value to replace.newvalue
- new value.public void replace(java.lang.string oldvalue, double[] newvalues, boolean isvertical)
oldvalue
- value to replace.newvalues
- new values.isvertical
- indicates whether new values should be inserted vertically.public void replace(java.lang.string oldvalue, int[] newvalues, boolean isvertical)
oldvalue
- value to replace.newvalues
- new values.isvertical
- indicates whether new values should be inserted vertically.public void replace(java.lang.string oldvalue, java.lang.string newvalue)
oldvalue
- value to replace.newvalue
- new valuepublic void replace(java.lang.string oldvalue, java.lang.string[] newvalues, boolean isvertical)
oldvalue
- value to replace.newvalues
- new values.isvertical
- indicates whether new values should be inserted vertically.public void resetpalette()
public void save()
public java.awt.image.bufferedimage[] saveasimage(float dpix, float dpiy)
dpix
- dpi xdpiy
- dpi y
public java.awt.image.bufferedimage saveasimage(int sheetindex, float dpix, float dpiy)
sheetindex
- sheet indexdpix
- dpi xdpiy
- dpi y
public void saveasxml(java.lang.string filename)
filename
- xml file name.public void saveasxml(java.io.inputstream stream)
stream
- stream object.public java.awt.image.bufferedimage savechartasimage(chartsheet chartsheet)
chartsheet
- chart sheet
public java.awt.image.bufferedimage[] savechartasimage(worksheet worksheet)
worksheet
- worksheet instance
public java.awt.image.bufferedimage savechartasimage(worksheet worksheet, int chartindex)
worksheet
- work sheetchartindex
- chart index
public void saveastemplate(java.lang.string filename)
filename
- public void savetostream(java.io.outputstream stream)
stream
- stream objectpublic void savetostream(java.io.outputstream stream, fileformat fileformat)
stream
- fileformat
- public void savetostream(java.io.outputstream stream, java.lang.string separator)
stream
- stream object.separator
- separatorpublic void setmaxdigitwidth(int w)
public void setolesize(int firstrow, int firstcolumn, int lastrow, int lastcolumn)
firstrow
- the visible range's first row indexfirstcolumn
- the visible range's first column indexlastrow
- the visible range's last row indexlastcolumn
- the visible range's last column indexpublic void setwriteprotectionpassword(java.lang.string password)
password
- password to setpublic void unprotect()
public void unprotect(java.lang.string bookwindowandstructurepassword)
bookwindowandstructurepassword
- password for protect workbook window and structurepublic void unprotectworkbook(java.lang.string password)
password
- passwordpublic chartsheet getchartsheetbyname(java.lang.string name)
public ixlsrange getolesize()
public boolean getprintusingimagemode()
public void setprintusingimagemode(boolean usingimagemode)
public java.nio.charset.charset getdefaultcharset()
public void setdefaultcharset(java.nio.charset.charset defaultcharset)
defaultcharset
- charset
|
|||||||||
prev class next class | frames no frames | ||||||||
summary: nested | field | constr | method | detail: field | constr | method |