org.eodisp.wrapper.excel
Class Workbook

java.lang.Object
  extended by org.eodisp.wrapper.excel.Workbook

public class Workbook
extends java.lang.Object

Represents an Excel Workbook.

Version:
$Id:$
Author:
ibirrer

Field Summary
(package private) static int WINDOW_WINDOWSTATE
           
static int WINDOW_XL_MAXIMIZED
           
 
Constructor Summary
Workbook(org.eclipse.swt.ole.win32.OleAutomation workbook, ExcelApplication excelApplication)
           
 
Method Summary
 void addSheetChangeListener(SheetChangeListener listener)
          Adds a sheet change listener to this workbook.
 void addSheetSelectionChangeListener(SheetSelectionChangeListener listener)
          Adds a selection change listener to this workbook.
 void close()
          Closes this workbook without saving any changes.
 void close(boolean saveChanges, java.io.File file)
          Closes this workbook.
 ExcelApplication getApplication()
          Return the application object that of the application that contains this workbook.
 java.util.List<Range> getNamedRanges()
          Get all ranges that have a name associated with it.
 Worksheet getWorksheet(int nr)
          Returns the n-th worksheet of this workbook.
 Worksheet getWorksheet(java.lang.String worksheetName)
          Returns a Worksheet of this workbook by its name.
 void removeSheetChangeListner(SheetChangeListener listener)
          Removes a sheet change listener from this workbook
 void removeSheetSelectionChangeListner(SheetSelectionChangeListener listener)
          Removes a selection change listener from this workbook.
 void setWindowState(int state)
          Set the window state to one of the following: WINDOW_XL_MAXIMIZED
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WINDOW_XL_MAXIMIZED

public static final int WINDOW_XL_MAXIMIZED
See Also:
Constant Field Values

WINDOW_WINDOWSTATE

static final int WINDOW_WINDOWSTATE
See Also:
Constant Field Values
Constructor Detail

Workbook

Workbook(org.eclipse.swt.ole.win32.OleAutomation workbook,
         ExcelApplication excelApplication)
Method Detail

addSheetChangeListener

public void addSheetChangeListener(SheetChangeListener listener)
Adds a sheet change listener to this workbook.

Parameters:
listener - the listener

removeSheetChangeListner

public void removeSheetChangeListner(SheetChangeListener listener)
Removes a sheet change listener from this workbook

Parameters:
listener - the listener to be removed

addSheetSelectionChangeListener

public void addSheetSelectionChangeListener(SheetSelectionChangeListener listener)
Adds a selection change listener to this workbook.

Parameters:
listener - the listener to be added

removeSheetSelectionChangeListner

public void removeSheetSelectionChangeListner(SheetSelectionChangeListener listener)
Removes a selection change listener from this workbook.

Parameters:
listener - the listener to be removed

getWorksheet

public Worksheet getWorksheet(java.lang.String worksheetName)
Returns a Worksheet of this workbook by its name.

Parameters:
worksheetName - the name of the worksheet
Returns:
the worksheet or null if no worksheet with the given name exists in this workbook.

getWorksheet

public Worksheet getWorksheet(int nr)
Returns the n-th worksheet of this workbook. Numbers begin at 1.

Parameters:
nr - the index of the worksheet
Returns:
the worksheet or null if the no worksheet with the given index exists.

getApplication

public ExcelApplication getApplication()
Return the application object that of the application that contains this workbook.

Returns:
the application.

setWindowState

public void setWindowState(int state)
Set the window state to one of the following:

Parameters:
state - only possible value so far: WINDOW_XL_MAXIMIZED

getNamedRanges

public java.util.List<Range> getNamedRanges()
Get all ranges that have a name associated with it. Not that names are unique in respect to the whole workbook, or in other words, it is not possible to have two ranges with the same name in two different Worksheets.

Returns:
a list of all named ranges in this workbook.

close

public void close(boolean saveChanges,
                  java.io.File file)
Closes this workbook.

Parameters:
saveChanges - If there are no changes to the workbook, this argument is ignored. If there are changes to the workbook and the workbook appears in other open windows, this argument is ignored. If there are changes to the workbook but the workbook does not appear in any other open windows, this argument specifies whether changes should be saved, as shown in the following list.
  • true: Saves the changes to the workbook. If there is not yet a file name associated with the workbook, then saveAs is used. If saveAs is null, the user is asked to supply a file name.
  • false: Does not save the changes to the workbook.
file - Save changes under this file

close

public void close()
Closes this workbook without saving any changes.