|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jniwrapper.win32.jexcel.Workbook
public class Workbook
This class provides functionality for working with an Excel workbook.
| Constructor Summary | |
|---|---|
Workbook(com.jniwrapper.win32.excel._Workbook workbook,
Application application)
|
|
| Method Summary | |
|---|---|
void |
activate()
Activates the workbook. |
void |
addWorkbookEventListener(WorkbookEventListener eventListener)
Adds the listener of workbook events. |
Worksheet |
addWorksheet(java.lang.String name)
Adds a worksheet to the workbook. |
Worksheet |
addWorksheet(Worksheet after,
java.lang.String name)
Adds a worksheet to the workbook. |
void |
close(boolean saveChanges)
Closes the workbook and optionally saves changes. |
void |
copyWorksheet(Worksheet worksheet,
Worksheet before,
Worksheet after)
Copies worksheet content to other worksheet. |
boolean |
equals(java.lang.Object o)
|
void |
exportAsFixedFormat(java.io.File file,
FixedFormatType formatType)
Exports the workbook to the PDF or XPS file that is specified by the file argument. |
Worksheet |
getActiveWorksheet()
Returns the active worksheet. |
Application |
getApplication()
Returns the application object. |
java.lang.String |
getAuthor()
Returns the workbook author name. |
java.io.File |
getFile()
Returns the workbook file. |
FileFormat |
getFileFormat()
Returns the format of the workbook file. |
com.jniwrapper.win32.excel._Workbook |
getNativePeer()
Returns the appropriate native peer. |
com.jniwrapper.win32.automation.OleMessageLoop |
getOleMessageLoop()
Returns the message loop thread for processing native peer function calls. |
java.lang.String |
getTitle()
Returns the currently set title of the workbook. |
Window |
getWindow()
Returns the windows that corresponds to the workbook. |
java.lang.String |
getWorkbookName()
Returns the name of the workbook. |
Worksheet |
getWorksheet(int index)
Returns the worksheet that is specified by its index. |
Worksheet |
getWorksheet(java.lang.String name)
Returns the worksheet that is specified by its name. |
int |
getWorksheetCount()
Returns the number of worksheets in the workbook. |
java.util.List |
getWorksheets()
Returns the list of worksheets of the workbook. |
boolean |
hasPassword()
Returns true if the workbook has a password. |
boolean |
isAutoDelete()
|
boolean |
isClosed()
Checks if the workbook is closed. |
boolean |
isReadOnly()
Checks if the workbook is read only. |
boolean |
isSaved()
Checks if the workbook is saved (have not benn changed since the last save operation). |
void |
mergeWorkbook(java.io.File wbfile)
Copies all worksheets from workbook file to current workbook |
void |
mergeWorkbook(GenericWorkbook source)
Copies all worksheets from source workbook to current workbook |
void |
moveWorksheet(Worksheet worksheet,
Worksheet after)
Move worksheet content to another. |
void |
print(int copies)
Prints the specified number of copies of the workbook. |
void |
print(int firstSheet,
int lastSheet,
int copies)
Prints the specified range of worksheet. |
void |
release()
Releases this wrapper object. |
void |
removeEventHandler()
Removes the handler of workbook events. |
void |
removeWorkbookEventListener(WorkbookEventListener eventListener)
Removes the specified listener of workbook events. |
void |
removeWorksheet(Worksheet worksheet)
Removes worksheet |
void |
save()
Saves changes in all worksheets of the workbook. |
void |
saveAs(java.io.File file,
FileFormat fileFormat,
boolean overwrite)
Saves the workbook to the file that is specified by the file argument. |
void |
saveCopyAs(java.io.File file)
Saves a copy of the workbook to another file. |
void |
setAuthor(java.lang.String author)
Specifies the workbook author name. |
void |
setAutoDelete(boolean value)
|
void |
setEventHandler(WorkbookEventHandler eventHandler)
Specifies the handler of workbook events. |
protected void |
setOleMessageLoop(com.jniwrapper.win32.automation.OleMessageLoop oleMessageLoop)
|
void |
setPassword(java.lang.String password)
Sets up a new opening password of the workbook. |
void |
setSaved(boolean value)
Force setting workbook "saved" status |
void |
setTitle(java.lang.String title)
Sets up the title of the workbook. |
void |
setWritePassword(java.lang.String password)
Sets up a new write protection password of the workbook. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.jniwrapper.win32.jexcel.GenericWorkbook |
|---|
getApplication |
| Constructor Detail |
|---|
public Workbook(com.jniwrapper.win32.excel._Workbook workbook,
Application application)
| Method Detail |
|---|
public Worksheet addWorksheet(java.lang.String name)
throws ExcelException
GenericWorkbook
addWorksheet in interface GenericWorkbookname - is the name of a new worksheet.
ExcelException - if a worksheet with such name already exists in the workbook.
public Worksheet addWorksheet(Worksheet after,
java.lang.String name)
throws ExcelException
GenericWorkbook
addWorksheet in interface GenericWorkbookafter - the worksheet will be added to the position after this worksheet.
If the value is null, the worksheet will be added
at the beginning of the worksheet list.name - is the name of a new worksheet.
ExcelException - if a worksheet with such name already exists in the workbook.public Worksheet getWorksheet(java.lang.String name)
GenericWorkbooknull.
getWorksheet in interface GenericWorkbookname - is the name of the worksheet.
null if such worksheet is not present.public java.util.List getWorksheets()
GenericWorkbookWorksheet class.
getWorksheets in interface GenericWorkbookpublic Worksheet getWorksheet(int index)
GenericWorkbook
getWorksheet in interface GenericWorkbookindex - is the index of the worksheet.
public Worksheet getActiveWorksheet()
GenericWorkbook
getActiveWorksheet in interface GenericWorkbookpublic void setEventHandler(WorkbookEventHandler eventHandler)
GenericWorkbook
setEventHandler in interface GenericWorkbookpublic void removeEventHandler()
GenericWorkbook
removeEventHandler in interface GenericWorkbookpublic void addWorkbookEventListener(WorkbookEventListener eventListener)
GenericWorkbook
addWorkbookEventListener in interface GenericWorkbookpublic void removeWorkbookEventListener(WorkbookEventListener eventListener)
GenericWorkbook
removeWorkbookEventListener in interface GenericWorkbookeventListener - is the listener to be removed.public void setTitle(java.lang.String title)
GenericWorkbook
setTitle in interface GenericWorkbooktitle - is a new title of the workbook.public java.lang.String getTitle()
GenericWorkbook
getTitle in interface GenericWorkbookpublic java.io.File getFile()
GenericWorkbook
getFile in interface GenericWorkbookpublic FileFormat getFileFormat()
GenericWorkbook
getFileFormat in interface GenericWorkbook
public void print(int copies)
throws javax.print.PrintException
GenericWorkbook
print in interface GenericWorkbookcopies - is the number of copies to be printed.
javax.print.PrintException - if print problems occured.
public void print(int firstSheet,
int lastSheet,
int copies)
throws javax.print.PrintException
GenericWorkbook
print in interface GenericWorkbookfirstSheet - is the index of the first worksheet to be printed.lastSheet - is the index of the last worksheet to be printed.copies - is the number of copies to be printed.
javax.print.PrintException - if print problems occured.public int getWorksheetCount()
GenericWorkbook
getWorksheetCount in interface GenericWorkbookpublic void setPassword(java.lang.String password)
GenericWorkbook
setPassword in interface GenericWorkbookpassword - is a new password to be set up.public boolean hasPassword()
GenericWorkbooktrue if the workbook has a password.
hasPassword in interface GenericWorkbooktrue if the workbook has a password.public void setWritePassword(java.lang.String password)
GenericWorkbook
setWritePassword in interface GenericWorkbookpassword - is a new write protection passwordpublic java.lang.String getWorkbookName()
GenericWorkbook
getWorkbookName in interface GenericWorkbookpublic boolean isReadOnly()
GenericWorkbook
isReadOnly in interface GenericWorkbooktrue if the workbook is read only.public boolean isSaved()
GenericWorkbook
isSaved in interface GenericWorkbooktrue if the workbook is saved.public void setSaved(boolean value)
value - - true to set saved and otherwise.public boolean isClosed()
GenericWorkbook
isClosed in interface GenericWorkbooktrue if the workbook is closed.public void close(boolean saveChanges)
saveChanges - specifies whether to save changes on closing.
java.lang.IllegalStateException - if the workbook is already closed.
public void save()
throws java.io.IOException
java.lang.IllegalStateException - if the workbook is closed.
java.io.IOException - if the workbook cannot be saved to the specified file.
public void exportAsFixedFormat(java.io.File file,
FixedFormatType formatType)
file argument.
file - specifies the file name.formatType - specifies the file format type: XPS or PDF.
java.lang.IllegalStateException - if the workbook is closed.
java.lang.RuntimeException - if the method is not supported by the current version of Excel.
public void saveAs(java.io.File file,
FileFormat fileFormat,
boolean overwrite)
throws java.io.IOException
file argument.
file - specifies the file name.fileFormat - specifies the file format.overwrite - if true then an existing file will be overwritten.
java.lang.IllegalStateException - if the workbook is closed.
java.io.IOException - if the workbook cannot be saved to the specified file.FileFormat
public void saveCopyAs(java.io.File file)
throws java.io.IOException
GenericWorkbook
saveCopyAs in interface GenericWorkbookfile - specifies the file name.
java.io.IOException - if the workbook cannot be saved to the specified file.public void activate()
GenericWorkbook
activate in interface GenericWorkbookpublic Window getWindow()
GenericWorkbook
getWindow in interface GenericWorkbookWindowpublic java.lang.String getAuthor()
GenericWorkbook
getAuthor in interface GenericWorkbookpublic void setAuthor(java.lang.String author)
GenericWorkbook
setAuthor in interface GenericWorkbookauthor - is the workbook author name.public void removeWorksheet(Worksheet worksheet)
removeWorksheet in interface GenericWorkbookworksheet - - target worksheet
public void moveWorksheet(Worksheet worksheet,
Worksheet after)
moveWorksheet in interface GenericWorkbookworksheet - - source worksheetafter - - insert source worksheet after this instance
public void copyWorksheet(Worksheet worksheet,
Worksheet before,
Worksheet after)
copyWorksheet in interface GenericWorkbookworksheet - - source Worksheet instanceafter - - insert copy after this instancebefore - - insert copy before this instance
public void mergeWorkbook(GenericWorkbook source)
throws ExcelException
source - - source workbook instance
ExcelException - - handled Excel exception
public void mergeWorkbook(java.io.File wbfile)
throws java.io.FileNotFoundException,
ExcelException
wbfile - - source workbook file
java.io.FileNotFoundException - - handled i/o exception
ExcelException - - handled Excel exceptionpublic com.jniwrapper.win32.excel._Workbook getNativePeer()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic void release()
public Application getApplication()
public com.jniwrapper.win32.automation.OleMessageLoop getOleMessageLoop()
protected void setOleMessageLoop(com.jniwrapper.win32.automation.OleMessageLoop oleMessageLoop)
public void setAutoDelete(boolean value)
setAutoDelete in interface com.jniwrapper.AutoDeleteParameterpublic boolean isAutoDelete()
isAutoDelete in interface com.jniwrapper.AutoDeleteParameterpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||