Holger's Java API

## com.antelmann.ooffice
Class OOCalc

    java.lang.Object
      com.antelmann.ooffice.AbstractOfficeDocument
          com.antelmann.ooffice.OOCalc

All Implemented Interfaces:
  OfficeDocument, QueryMechanism, Closeable

    public class OOCalc

extends AbstractOfficeDocument

simplifies handling of OpenOffice spreadsheets This class implements ThirdParty for its use of OpenOffice libraries; see www.openoffice.org

Author:
  Holger Antelmann
See Also:
  `Cell`

Field Summary
`static String` `CSV_FILTER`
`static int` `MAX_COLUMNS`
`static int` `MAX_ROWS`
`static String` `MS_EXCEL_FILTER`
`static String` `TIME_FORMAT`

Constructor Summary
`OOCalc()` creates a visible blank new spreadsheet
`OOCalc(boolean hidden)` creates a blank new spreadsheet
`OOCalc(boolean previewMode, File template)`
`OOCalc(File template)` creates a visible new document based on the given template file
`OOCalc(File template, boolean hidden)` creates a new document based on the given template file
`OOCalc(File file, Map<?,?> props)` loads a document (the given file) into a blank frame along with the given properties
`OOCalc(InputStream in, boolean hidden)`
`OOCalc(InputStream in, Map<?,?> props)`
`OOCalc(URL templateURL, boolean hidden)` creates a new document based on the given template file
`OOCalc(com.sun.star.lang.XComponent comp)`
`OOCalc(com.sun.star.sheet.XSpreadsheetDocument document)`

Method Summary
`TableModel` `asTableModel(int sheet, int rowStart, int columnStart, int rowCount, int columnCount, boolean firstRowIsHeaderRow, boolean useDisplayValue)`
`TableModel` `asTableModel(int sheet, String namedRange, boolean firstRowIsHeaderRow, boolean useDisplayValue)`
`TableModel` `asTableModel(int sheet, com.sun.star.table.XCellRange range, boolean firstRowIsHeaderRow, boolean useDisplayValue)`
`TableModel` `asTableModel(String sheet, int rowStart, int columnStart, int rowCount, int columnCount, boolean firstRowIsHeaderRow, boolean useDisplayValue)` provides a modifiable view of the sheet data as a TableModel; the model is directly backed by the sheet data
`TableModel` `asTableModel(String sheet, String namedRange, boolean firstRowIsHeaderRow, boolean useDisplayValue)`
`TableModel` `asTableModel(String sheet, com.sun.star.table.XCellRange range, boolean firstRowIsHeaderRow, boolean useDisplayValue)`
`void` `copy(com.sun.star.table.XCellRange source, com.sun.star.table.XCell target)`
`void` `copySheet(String origin, String target, int index)`
`protected com.sun.star.table.TableBorder` `createBorder(CellBorder border)`
`void` `deleteColumn(com.sun.star.table.XCellRange range, int count)`
`void` `deleteImage(com.sun.star.sheet.XSpreadsheet sheet, String name)`
`void` `deleteRow(com.sun.star.table.XCellRange range, int count)`
`Iterator<Cell>` `findTextCells(int sheet, Filter<? super Cell> filter)`
`void` `formatCell(com.sun.star.table.XCell cell, Font font)`
`void` `formatCell(com.sun.star.table.XCellRange range, Font font)`
`void` `freezePosition(Cell.Location location)`
`static OOCalc` `getActiveDocument()` seeks the currently active document on the desktop (if any) and returns it
`int` `getActiveSheet()`
`Cell` `getCell(int sheetNo, int row, int column)`
`Cell` `getCell(int sheet, String name)`
`Cell` `getCell(String namedRange)`
`Cell` `getCell(String sheet, int row, int column)`
`Cell` `getCell(String sheet, String name)`
`Object` `getCellContent(com.sun.star.table.XCell cell)`
`Date` `getCellDate(Cell cell)` allows to interpret the contents of the given cell as a Date
`String` `getCellFormula(com.sun.star.table.XCell cell)`
`com.sun.star.table.XCellRange` `getCellRange(int sheet, Rectangle cellRange)`
`com.sun.star.table.XCellRange` `getCellRange(int sheet, String cellRangeName)`
`com.sun.star.table.XCellRange` `getCellRange(String namedRange)`
`com.sun.star.table.XCellRange` `getCellRange(String sheet, String cellRangeName)`
`String` `getCellText(com.sun.star.table.XCell cell)` based on the unquoted formula
`double` `getCellValue(com.sun.star.table.XCell cell)` returns 0 if the cell doesn't have a numeric value
`Object` `getColumn(int sheet, int column)`
`int` `getColumnFor(com.sun.star.table.XCell cell)`
`int` `getColumnWidth(int sheet, int column)`
`String` `getDisplayValue(com.sun.star.table.XCell cell)` based on the formatted text that is displayed in the cell (as opposed to the formula or value)
`com.sun.star.sheet.XSpreadsheetDocument` `getDocument()`
`OODocType` `getDocumentType()`
`Cell` `getFirstCell(int sheetNo, String cellRangeName)` returns the upper-left corner cell for the given range
`Cell` `getFirstCell(String sheet, String cellRangeName)` returns the upper-left corner cell for the given range
`Cell` `getFirstSelectedCell()`
`Object` `getImageByName(com.sun.star.sheet.XSpreadsheet sheet, String name)`
`String[]` `getImageNames(com.sun.star.sheet.XSpreadsheet sheet)`
`Cell` `getLastCellForRange(int sheetNo, int startRow, int startColumn, int endRow, int endColumn)`
`Cell` `getLastCellForRange(com.sun.star.sheet.XSpreadsheet sheet, com.sun.star.table.XCellRange range)`
`String[]` `getNamedCellRanges()`
`Rectangle` `getPosition(com.sun.star.table.XCell cell)` provides the position in pixel
`Rectangle` `getPosition(com.sun.star.table.XCellRange range)` provides the position in pixel
`Object` `getRow(int sheet, int row)`
`int` `getRowFor(com.sun.star.table.XCell cell)`
`int` `getRowHeight(int sheet, int row)`
`com.sun.star.table.XCellRange` `getSelectedRange()`
`com.sun.star.sheet.XSpreadsheet` `getSheet(int index)`
`com.sun.star.sheet.XSpreadsheet` `getSheet(String name)`
`int` `getSheetFor(String namedRange)`
`int` `getSheetFor(com.sun.star.table.XCell cell)`
`int` `getSheetIndex(String sheetName)`
`String` `getSheetNameFor(com.sun.star.table.XCell cell)`
`String[]` `getSheetNames()`
`com.sun.star.lang.XComponent` `getXComponent()`
`void` `gotoEnd()`
`void` `insert(int sheet, Rectangle cellRange, Direction moveDirection)`
`void` `insert(com.sun.star.table.XCellRange range, Direction moveDirection)`
`void` `insertColumn(com.sun.star.table.XCellRange range, int count)`
`String` `insertImage(int sheet, Image image, Point point)`
`String` `insertImage(int sheet, URL url, Rectangle rectangle)`
`String` `insertImage(com.sun.star.sheet.XSpreadsheet sheet, URL url, Rectangle rectangle)`
`String` `insertImage(com.sun.star.sheet.XSpreadsheet sheet, URL url, Rectangle rectangle, String name)`
`void` `insertNewSheet(String name, int index)`
`void` `insertRow(com.sun.star.table.XCellRange range, int count)`
`boolean` `isColumnVisible(int sheet, int column)`
`boolean` `isEmpty(com.sun.star.table.XCell cell)`
`boolean` `isFormula(com.sun.star.table.XCell cell)`
`boolean` `isManualPageBreak(com.sun.star.table.XCell cell)` determines whether there has been a manual page break set for the row of the given cell.
`boolean` `isRowVisible(int sheet, int row)`
`Iterator<Cell>` `iterateSelection()`
`ArrayList<Cell>` `listCells(com.sun.star.table.XCellRange range)`
`void` `move(com.sun.star.table.XCellRange source, com.sun.star.table.XCell target)`
`void` `moveSheetToIndex(String name, int index)`
`static OOCalc` `open(File file, boolean readOnly, boolean previewMode)` opens a document with the specified options
`static OOCalc` `openFile(File file)` opens a document for editing
`static OOCalc` `openFile(File file, boolean hidden)` opens a document for editing
`static OOCalc` `openReadOnly(File file)` opens a document in read-only mode
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, Cell.Location upperLeftCorner, boolean includeHeader, Monitor mon)`
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, int sheet, int row, int column, boolean includeHeader)`
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, int sheet, String range, boolean includeHeader)`
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, String sheet, int row, int column, boolean includeHeader)`
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, String sheet, int row, int column, boolean includeHeader, Monitor mon)`
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, String sheet, String range, boolean includeHeader)`
`com.sun.star.table.XCellRange` `placeTableModel(TableModel model, com.sun.star.table.XCell upperLeftCorner, boolean includeHeader, Monitor mon)` places the given model into the spreadsheet with the upper left corner at the given location
`void` `print(Map<?,?> printerProperties, Map<?,?> jobProperties)`
`Cell` `relativeMove(com.sun.star.table.XCell cell, Direction direction, int count)`
`Cell` `relativeMove(com.sun.star.table.XCell cell, int xOffset, int yOffset)`
`void` `remove(int sheet, Rectangle cellRange, Direction moveDirection)`
`void` `remove(com.sun.star.table.XCellRange range, Direction moveDirection)`
`void` `removeSheet(int index)`
`void` `removeSheet(String name)`
`void` `renameSheet(int index, String newName)`
`void` `renameSheet(String oldName, String newName)`
`void` `replace(com.sun.star.table.XCellRange range, String search, String replace)`
`void` `setCellAligment(com.sun.star.table.XCell cell, ParagraphAlignment alignment)`
`void` `setCellBackground(com.sun.star.table.XCell cell, Color color)`
`void` `setCellBorder(com.sun.star.table.XCell cell, CellBorder border)`
`void` `setCellBorder(com.sun.star.table.XCellRange range, CellBorder border)`
`void` `setCellDate(com.sun.star.table.XCell cell, Date date)`
`void` `setCellDateTime(com.sun.star.table.XCell cell, Date date)`
`void` `setCellFormat(com.sun.star.table.XCell cell, Cell.Format format)`
`void` `setCellFormat(com.sun.star.table.XCell cell, CharacterFormat option)`
`void` `setCellFormat(com.sun.star.table.XCellRange range, Cell.Format format)`
`void` `setCellFormat(com.sun.star.table.XCell cell, Underline option)`
`void` `setCellFormula(com.sun.star.table.XCell cell, String formula)`
`void` `setCellProperty(com.sun.star.table.XCellRange range, String key, Object value)`
`void` `setCellProperty(com.sun.star.table.XCell cell, String key, Object value)`
`void` `setCellText(com.sun.star.table.XCell cell, String text)`
`void` `setCellTextColor(com.sun.star.table.XCell cell, Color color)`
`void` `setCellTime(com.sun.star.table.XCell cell, Date date)`
`void` `setCellTime(com.sun.star.table.XCell cell, long millis)`
`void` `setCellTime(com.sun.star.table.XCell cell, TimeInDay time)`
`void` `setCellValue(com.sun.star.table.XCell cell, double value)`
`void` `setCellValue(com.sun.star.table.XCell cell, Number value, String format)` cell, value and format must not be null
`void` `setCellValue(com.sun.star.table.XCell cell, Object value)` makes a best effort to set the cell's value using an appropriate format
`void` `setCellValue(com.sun.star.table.XCell cell, String value, Cell.Format format)` cell, value and format must not be null
`void` `setColumnVisible(int sheet, int column, boolean visible)`
`void` `setColumnWidth(int sheet, int column, int width)`
`void` `setManualPageBreak(com.sun.star.table.XCell cell, boolean flag)` #see `isManualPageBreak(XCell)`
`void` `setNumberFormat(com.sun.star.table.XCellRange range, String numberFormatString)`
`void` `setNumberFormat(com.sun.star.table.XCell cell, String numberFormatString)`
`void` `setOptimalColumnWidth(int sheet, int column)`
`void` `setOptimalColumnWidth(com.sun.star.sheet.XSpreadsheet sheet, int column)`
`boolean` `setProtection(com.sun.star.sheet.XSpreadsheet sheet, String password, boolean protect)` alters the protection of the given sheet
`void` `setRowHeight(int sheet, int row, int width)`
`void` `setRowVisible(int sheet, int row, boolean visible)`
`void` `setSelectedRange(String range)`
`static Date` `toDate(Number n)`
`static double` `toNumber(Date date)`

Methods inherited from class com.antelmann.ooffice.AbstractOfficeDocument

`addCloseListener, close, dispatchCommand, dispatchCommand, dispatchCommand, dispatchCommand, dispose, exportAsHTMLString, exportAsString, exportFormat, exportHTML, exportPDF, exportToHTML, exportToPDF, formatText, formatText, formatText, formatText, getController, getDocumentProperties, getFile, getFont, getHtmlFormat, getPdfFormat, getXFrame, print, print, print, print, query, save, setComponentVisible, setEnableComponent, setEnableFrame, setFrameVisible, setPageOrientation, setPropertyValue, storeTo, storeTo, storeTo, storeTo, storeTo, undo, updateAll`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MS_EXCEL_FILTER

    public static final String MS_EXCEL_FILTER

See Also:
  Constant Field Values

### CSV_FILTER

    public static final String CSV_FILTER

See Also:
  Constant Field Values

### TIME_FORMAT

    public static final String TIME_FORMAT

See Also:
  Constant Field Values

### MAX_COLUMNS

    public static final int MAX_COLUMNS

See Also:
  Constant Field Values

### MAX_ROWS

    public static final int MAX_ROWS

See Also:
  Constant Field Values

Constructor Detail

### OOCalc

    public OOCalc()
           throws OfficeException

  creates a visible blank new spreadsheet

  Throws:
    `OfficeException`

### OOCalc

    public OOCalc(boolean hidden)
           throws OfficeException

  creates a blank new spreadsheet

  Throws:
    `OfficeException`

### OOCalc

    public OOCalc(File template)
           throws OfficeException,
                  IOException

  creates a visible new document based on the given template file

  Throws:
    `OfficeException`
    `IOException`

### OOCalc

    public OOCalc(boolean previewMode,
                  File template)
           throws OfficeException,
                  IOException

Throws:
  `OfficeException`
  `IOException`

### OOCalc

    public OOCalc(File template,
                  boolean hidden)
           throws OfficeException,
                  IOException

  creates a new document based on the given template file

  Throws:
    `OfficeException`
    `IOException`

### OOCalc

    public OOCalc(URL templateURL,
                  boolean hidden)
           throws OfficeException,
                  IOException

  creates a new document based on the given template file

  Throws:
    `OfficeException`
    `IOException`

### OOCalc

    public OOCalc(File file,
                  Map<?,?> props)
           throws OfficeException,
                  IOException

  loads a document (the given file) into a blank frame along with the given properties

  Throws:
    `OfficeException`
    `IOException`

### OOCalc

    public OOCalc(InputStream in,
                  boolean hidden)
           throws OfficeException,
                  IOException

Throws:
  `OfficeException`
  `IOException`

### OOCalc

    public OOCalc(InputStream in,
                  Map<?,?> props)
           throws OfficeException,
                  IOException

Throws:
  `OfficeException`
  `IOException`

### OOCalc

    public OOCalc(com.sun.star.lang.XComponent comp)
           throws OfficeException

Throws:
  `OfficeException`

### OOCalc

    public OOCalc(com.sun.star.sheet.XSpreadsheetDocument document)

Method Detail

### getActiveDocument

    public static OOCalc getActiveDocument()
                                    throws OfficeException

  seeks the currently active document on the desktop (if any) and returns it

  Throws:
    `OfficeException`

### openFile

    public static OOCalc openFile(File file)
                           throws OfficeException,
                                  IOException

  opens a document for editing

  Throws:
    `OfficeException`
    `IOException`

### openFile

    public static OOCalc openFile(File file,
                                  boolean hidden)
                           throws OfficeException,
                                  IOException

  opens a document for editing

  Throws:
    `OfficeException`
    `IOException`

### openReadOnly

    public static OOCalc openReadOnly(File file)
                               throws OfficeException,
                                      IOException

  opens a document in read-only mode

  Throws:
    `OfficeException`
    `IOException`

### open

    public static OOCalc open(File file,
                              boolean readOnly,
                              boolean previewMode)
                       throws OfficeException,
                              IOException

  opens a document with the specified options

  Throws:
    `OfficeException`
    `IOException`

### getDocument

    public com.sun.star.sheet.XSpreadsheetDocument getDocument()

### getXComponent

    public com.sun.star.lang.XComponent getXComponent()

### getSheetNames

    public String[] getSheetNames()

### getSheetIndex

    public int getSheetIndex(String sheetName)

### setProtection

    public boolean setProtection(com.sun.star.sheet.XSpreadsheet sheet,
                                 String password,
                                 boolean protect)
                          throws IllegalArgumentException

  alters the protection of the given sheet

  Parameters:
    `sheet` - the sheet to be altered
    `password` - the password to be used for protection/unprotection
    `protect` - determines whether to protect or unprotect
  Returns:
    true only if the protection state was actually changed
  Throws:
    `IllegalArgumentException` - if the password was incorrect for unprotection

### getSheet

    public com.sun.star.sheet.XSpreadsheet getSheet(int index)
                                             throws OfficeException

  Throws:
    `OfficeException`

### getSheet

    public com.sun.star.sheet.XSpreadsheet getSheet(String name)
                                             throws OfficeException,
                                                    IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getActiveSheet

    public int getActiveSheet()

### getFirstSelectedCell

    public Cell getFirstSelectedCell()

### iterateSelection

    public Iterator<Cell> iterateSelection()

### listCells

    public ArrayList<Cell> listCells(com.sun.star.table.XCellRange range)
                              throws OfficeException

  Throws:
    `OfficeException`

### getNamedCellRanges

    public String[] getNamedCellRanges()
                                throws OfficeException

  Throws:
    `OfficeException`

### getSheetFor

    public int getSheetFor(String namedRange)
                    throws IllegalArgumentException,
                           OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### getLastCellForRange

    public Cell getLastCellForRange(int sheetNo,
                                    int startRow,
                                    int startColumn,
                                    int endRow,
                                    int endColumn)
                             throws OfficeException

  Throws:
    `OfficeException`

### getLastCellForRange

    public Cell getLastCellForRange(com.sun.star.sheet.XSpreadsheet sheet,
                                    com.sun.star.table.XCellRange range)
                             throws IndexOutOfBoundsException

  Throws:
    `IndexOutOfBoundsException`

### findTextCells

    public Iterator<Cell> findTextCells(int sheet,
                                        Filter<? super Cell> filter)
                                 throws OfficeException

  Throws:
    `OfficeException`

### replace

    public void replace(com.sun.star.table.XCellRange range,
                        String search,
                        String replace)

### getColumn

    public Object getColumn(int sheet,
                            int column)
                     throws IllegalArgumentException,
                            OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### getRow

    public Object getRow(int sheet,
                         int row)
                  throws IllegalArgumentException,
                         OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### getColumnWidth

    public int getColumnWidth(int sheet,
                              int column)
                       throws IllegalArgumentException,
                              OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### setColumnWidth

    public void setColumnWidth(int sheet,
                               int column,
                               int width)
                        throws IllegalArgumentException,
                               OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### setOptimalColumnWidth

    public void setOptimalColumnWidth(int sheet,
                                      int column)
                               throws OfficeException,
                                      IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### setOptimalColumnWidth

    public void setOptimalColumnWidth(com.sun.star.sheet.XSpreadsheet sheet,
                                      int column)
                               throws OfficeException,
                                      IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### isColumnVisible

    public boolean isColumnVisible(int sheet,
                                   int column)
                            throws IllegalArgumentException,
                                   OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### setColumnVisible

    public void setColumnVisible(int sheet,
                                 int column,
                                 boolean visible)
                          throws IllegalArgumentException,
                                 OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### isRowVisible

    public boolean isRowVisible(int sheet,
                                int row)
                         throws IllegalArgumentException,
                                OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### setRowVisible

    public void setRowVisible(int sheet,
                              int row,
                              boolean visible)
                       throws IllegalArgumentException,
                              OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### getRowHeight

    public int getRowHeight(int sheet,
                            int row)
                     throws IllegalArgumentException,
                            OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### setRowHeight

    public void setRowHeight(int sheet,
                             int row,
                             int width)
                      throws IllegalArgumentException,
                             OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### isManualPageBreak

    public boolean isManualPageBreak(com.sun.star.table.XCell cell)
                              throws OfficeException

  determines whether there has been a manual page break set for the row of the given cell. The break occurs before the row of the cell

  Throws:
    `OfficeException`
  See Also:
    `setManualPageBreak(XCell, boolean)`

### setManualPageBreak

    public void setManualPageBreak(com.sun.star.table.XCell cell,
                                   boolean flag)
                            throws OfficeException

  #see `isManualPageBreak(XCell)`

  Throws:
    `OfficeException`

### getCell

    public Cell getCell(int sheetNo,
                        int row,
                        int column)
                 throws OfficeException,
                        IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCell

    public Cell getCell(String sheet,
                        int row,
                        int column)
                 throws OfficeException,
                        IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCell

    public Cell getCell(int sheet,
                        String name)
                 throws OfficeException,
                        IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCell

    public Cell getCell(String namedRange)
                 throws OfficeException,
                        IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCell

    public Cell getCell(String sheet,
                        String name)
                 throws OfficeException,
                        IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCellRange

    public com.sun.star.table.XCellRange getCellRange(String namedRange)
                                               throws IllegalArgumentException,
                                                      OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### getCellRange

    public com.sun.star.table.XCellRange getCellRange(int sheet,
                                                      String cellRangeName)
                                               throws OfficeException,
                                                      IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCellRange

    public com.sun.star.table.XCellRange getCellRange(String sheet,
                                                      String cellRangeName)
                                               throws OfficeException,
                                                      IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getCellRange

    public com.sun.star.table.XCellRange getCellRange(int sheet,
                                                      Rectangle cellRange)
                                               throws OfficeException,
                                                      IndexOutOfBoundsException

  Throws:
    `OfficeException`
    `IndexOutOfBoundsException`

### getFirstCell

    public Cell getFirstCell(String sheet,
                             String cellRangeName)
                      throws OfficeException,
                             IllegalArgumentException

  returns the upper-left corner cell for the given range

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getFirstCell

    public Cell getFirstCell(int sheetNo,
                             String cellRangeName)
                      throws OfficeException,
                             IllegalArgumentException

  returns the upper-left corner cell for the given range

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### getSelectedRange

    public com.sun.star.table.XCellRange getSelectedRange()

### setSelectedRange

    public void setSelectedRange(String range)
                          throws OfficeException

  Throws:
    `OfficeException`

### gotoEnd

    public void gotoEnd()
                 throws OfficeException

  Throws:
    `OfficeException`

### insertRow

    public void insertRow(com.sun.star.table.XCellRange range,
                          int count)

### insertColumn

    public void insertColumn(com.sun.star.table.XCellRange range,
                             int count)

### deleteRow

    public void deleteRow(com.sun.star.table.XCellRange range,
                          int count)

### deleteColumn

    public void deleteColumn(com.sun.star.table.XCellRange range,
                             int count)

### copy

    public void copy(com.sun.star.table.XCellRange source,
                     com.sun.star.table.XCell target)
              throws OfficeException

  Throws:
    `OfficeException`

### move

    public void move(com.sun.star.table.XCellRange source,
                     com.sun.star.table.XCell target)
              throws OfficeException

  Throws:
    `OfficeException`

### remove

    public void remove(int sheet,
                       Rectangle cellRange,
                       Direction moveDirection)
                throws OfficeException

  Throws:
    `OfficeException`

### remove

    public void remove(com.sun.star.table.XCellRange range,
                       Direction moveDirection)
                throws OfficeException

  Throws:
    `OfficeException`

### insert

    public void insert(int sheet,
                       Rectangle cellRange,
                       Direction moveDirection)
                throws OfficeException

  Throws:
    `OfficeException`

### insert

    public void insert(com.sun.star.table.XCellRange range,
                       Direction moveDirection)
                throws OfficeException

  Throws:
    `OfficeException`

### setCellValue

    public void setCellValue(com.sun.star.table.XCell cell,
                             double value)

### setCellFormula

    public void setCellFormula(com.sun.star.table.XCell cell,
                               String formula)

### setCellDate

    public void setCellDate(com.sun.star.table.XCell cell,
                            Date date)
                     throws OfficeException,
                            IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### setCellTime

    public void setCellTime(com.sun.star.table.XCell cell,
                            long millis)
                     throws OfficeException

  Throws:
    `OfficeException`

### setCellTime

    public void setCellTime(com.sun.star.table.XCell cell,
                            TimeInDay time)
                     throws OfficeException,
                            IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### setCellTime

    public void setCellTime(com.sun.star.table.XCell cell,
                            Date date)
                     throws OfficeException,
                            IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### setCellDateTime

    public void setCellDateTime(com.sun.star.table.XCell cell,
                                Date date)
                         throws OfficeException,
                                IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### setCellText

    public void setCellText(com.sun.star.table.XCell cell,
                            String text)
                     throws OfficeException

  Throws:
    `OfficeException`

### getDisplayValue

    public String getDisplayValue(com.sun.star.table.XCell cell)

  based on the formatted text that is displayed in the cell (as opposed to the formula or value)

### isEmpty

    public boolean isEmpty(com.sun.star.table.XCell cell)

### getCellText

    public String getCellText(com.sun.star.table.XCell cell)

  based on the unquoted formula

### getCellValue

    public double getCellValue(com.sun.star.table.XCell cell)

  returns 0 if the cell doesn't have a numeric value

### getCellContent

    public Object getCellContent(com.sun.star.table.XCell cell)

### getCellFormula

    public String getCellFormula(com.sun.star.table.XCell cell)

### isFormula

    public boolean isFormula(com.sun.star.table.XCell cell)

### setCellValue

    public void setCellValue(com.sun.star.table.XCell cell,
                             Object value)
                      throws OfficeException

  makes a best effort to set the cell's value using an appropriate format

  Throws:
    `OfficeException`

### setCellValue

    public void setCellValue(com.sun.star.table.XCell cell,
                             Number value,
                             String format)
                      throws OfficeException

  cell, value and format must not be null

  Throws:
    `OfficeException`

### setCellValue

    public void setCellValue(com.sun.star.table.XCell cell,
                             String value,
                             Cell.Format format)
                      throws OfficeException

  cell, value and format must not be null

  Throws:
    `OfficeException`

### setCellTextColor

    public void setCellTextColor(com.sun.star.table.XCell cell,
                                 Color color)
                          throws OfficeException

  Throws:
    `OfficeException`

### formatCell

    public void formatCell(com.sun.star.table.XCell cell,
                           Font font)
                    throws OfficeException

  Throws:
    `OfficeException`

### formatCell

    public void formatCell(com.sun.star.table.XCellRange range,
                           Font font)
                    throws OfficeException

  Throws:
    `OfficeException`

### setCellFormat

    public void setCellFormat(com.sun.star.table.XCell cell,
                              Cell.Format format)
                       throws OfficeException

  Throws:
    `OfficeException`
  See Also:
    `Cell.Format.applyTo(OOCalc, Object, Locale)`

### setCellFormat

    public void setCellFormat(com.sun.star.table.XCellRange range,
                              Cell.Format format)
                       throws OfficeException

  Throws:
    `OfficeException`
  See Also:
    `Cell.Format.applyTo(OOCalc, Object, Locale)`

### setNumberFormat

    public void setNumberFormat(com.sun.star.table.XCellRange range,
                                String numberFormatString)
                         throws OfficeException

  Throws:
    `OfficeException`

### setNumberFormat

    public void setNumberFormat(com.sun.star.table.XCell cell,
                                String numberFormatString)
                         throws OfficeException

  Throws:
    `OfficeException`

### setCellBackground

    public void setCellBackground(com.sun.star.table.XCell cell,
                                  Color color)
                           throws OfficeException

  Throws:
    `OfficeException`

### setCellAligment

    public void setCellAligment(com.sun.star.table.XCell cell,
                                ParagraphAlignment alignment)
                         throws OfficeException

  Throws:
    `OfficeException`

### setCellFormat

    public void setCellFormat(com.sun.star.table.XCell cell,
                              Underline option)
                       throws OfficeException

  Throws:
    `OfficeException`

### setCellFormat

    public void setCellFormat(com.sun.star.table.XCell cell,
                              CharacterFormat option)
                       throws OfficeException

  Throws:
    `OfficeException`

### setCellBorder

    public void setCellBorder(com.sun.star.table.XCellRange range,
                              CellBorder border)
                       throws OfficeException

  Throws:
    `OfficeException`

### setCellBorder

    public void setCellBorder(com.sun.star.table.XCell cell,
                              CellBorder border)
                       throws OfficeException

  Throws:
    `OfficeException`

### createBorder

    protected com.sun.star.table.TableBorder createBorder(CellBorder border)

### setCellProperty

    public void setCellProperty(com.sun.star.table.XCell cell,
                                String key,
                                Object value)
                         throws OfficeException

  Throws:
    `OfficeException`

### setCellProperty

    public void setCellProperty(com.sun.star.table.XCellRange range,
                                String key,
                                Object value)
                         throws OfficeException

  Throws:
    `OfficeException`

### getCellDate

    public Date getCellDate(Cell cell)

  allows to interpret the contents of the given cell as a Date

### toDate

    public static Date toDate(Number n)

### toNumber

    public static double toNumber(Date date)

### getSheetNameFor

    public String getSheetNameFor(com.sun.star.table.XCell cell)

### relativeMove

    public Cell relativeMove(com.sun.star.table.XCell cell,
                             Direction direction,
                             int count)
                      throws OfficeException

  Throws:
    `OfficeException`

### relativeMove

    public Cell relativeMove(com.sun.star.table.XCell cell,
                             int xOffset,
                             int yOffset)
                      throws OfficeException

  Throws:
    `OfficeException`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         int sheet,
                                                         int row,
                                                         int column,
                                                         boolean includeHeader)
                                                  throws OfficeException

  Throws:
    `OfficeException`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         String sheet,
                                                         int row,
                                                         int column,
                                                         boolean includeHeader)
                                                  throws OfficeException

  Throws:
    `OfficeException`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         String sheet,
                                                         String range,
                                                         boolean includeHeader)
                                                  throws OfficeException

  Throws:
    `OfficeException`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         int sheet,
                                                         String range,
                                                         boolean includeHeader)
                                                  throws OfficeException

  Throws:
    `OfficeException`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         String sheet,
                                                         int row,
                                                         int column,
                                                         boolean includeHeader,
                                                         Monitor mon)
                                                  throws OfficeException

  Throws:
    `OfficeException`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         Cell.Location upperLeftCorner,
                                                         boolean includeHeader,
                                                         Monitor mon)
                                                  throws OfficeException,
                                                         CancellationWarning

  Throws:
    `OfficeException`
    `CancellationWarning`

### placeTableModel

    public com.sun.star.table.XCellRange placeTableModel(TableModel model,
                                                         com.sun.star.table.XCell upperLeftCorner,
                                                         boolean includeHeader,
                                                         Monitor mon)
                                                  throws OfficeException,
                                                         CancellationWarning

  places the given model into the spreadsheet with the upper left corner at the given location

  Returns:
    the cell range where the model has been placed
  Throws:
    `OfficeException`
    `CancellationWarning`

### freezePosition

    public void freezePosition(Cell.Location location)
                        throws IllegalArgumentException,
                               OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### getRowFor

    public int getRowFor(com.sun.star.table.XCell cell)

### getColumnFor

    public int getColumnFor(com.sun.star.table.XCell cell)

### getSheetFor

    public int getSheetFor(com.sun.star.table.XCell cell)

### asTableModel

    public TableModel asTableModel(int sheet,
                                   String namedRange,
                                   boolean firstRowIsHeaderRow,
                                   boolean useDisplayValue)
                            throws IllegalArgumentException,
                                   OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### asTableModel

    public TableModel asTableModel(String sheet,
                                   String namedRange,
                                   boolean firstRowIsHeaderRow,
                                   boolean useDisplayValue)
                            throws IllegalArgumentException,
                                   OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### asTableModel

    public TableModel asTableModel(int sheet,
                                   com.sun.star.table.XCellRange range,
                                   boolean firstRowIsHeaderRow,
                                   boolean useDisplayValue)
                            throws IllegalArgumentException,
                                   OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### asTableModel

    public TableModel asTableModel(String sheet,
                                   com.sun.star.table.XCellRange range,
                                   boolean firstRowIsHeaderRow,
                                   boolean useDisplayValue)
                            throws IllegalArgumentException,
                                   OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### asTableModel

    public TableModel asTableModel(int sheet,
                                   int rowStart,
                                   int columnStart,
                                   int rowCount,
                                   int columnCount,
                                   boolean firstRowIsHeaderRow,
                                   boolean useDisplayValue)

### asTableModel

    public TableModel asTableModel(String sheet,
                                   int rowStart,
                                   int columnStart,
                                   int rowCount,
                                   int columnCount,
                                   boolean firstRowIsHeaderRow,
                                   boolean useDisplayValue)

  provides a modifiable view of the sheet data as a TableModel; the model is directly backed by the sheet data

  Parameters:
    `useDisplayValue` - if true, `TableModel.getValueAt(int, int)` uses `getDisplayValue(XCell)`, otherwise `getCellContent(XCell)`
  See Also:
    `TableModelCopy`

### getPosition

    public Rectangle getPosition(com.sun.star.table.XCellRange range)
                          throws OfficeException

  provides the position in pixel

  Throws:
    `OfficeException`

### getPosition

    public Rectangle getPosition(com.sun.star.table.XCell cell)
                          throws OfficeException

  provides the position in pixel

  Throws:
    `OfficeException`

### insertImage

    @Warning(value="a temporary file that is created here cannot be deleted until OpenOffice has shut down, unfortunately")
    public String insertImage(int sheet,
                                           Image image,
                                           Point point)
                       throws IOException,
                              OfficeException

  Throws:
    `IOException`
    `OfficeException`

### insertImage

    public String insertImage(int sheet,
                              URL url,
                              Rectangle rectangle)
                       throws IOException,
                              OfficeException

  Throws:
    `IOException`
    `OfficeException`

### insertImage

    public String insertImage(com.sun.star.sheet.XSpreadsheet sheet,
                              URL url,
                              Rectangle rectangle)
                       throws IOException,
                              OfficeException

  Throws:
    `IOException`
    `OfficeException`

### insertImage

    public String insertImage(com.sun.star.sheet.XSpreadsheet sheet,
                              URL url,
                              Rectangle rectangle,
                              String name)
                       throws IOException,
                              OfficeException

  Throws:
    `IOException`
    `OfficeException`

### getImageNames

    public String[] getImageNames(com.sun.star.sheet.XSpreadsheet sheet)
                           throws OfficeException

  Throws:
    `OfficeException`

### getImageByName

    public Object getImageByName(com.sun.star.sheet.XSpreadsheet sheet,
                                 String name)
                          throws OfficeException

  Throws:
    `OfficeException`

### deleteImage

    public void deleteImage(com.sun.star.sheet.XSpreadsheet sheet,
                            String name)
                     throws OfficeException,
                            IllegalArgumentException

  Throws:
    `OfficeException`
    `IllegalArgumentException`

### renameSheet

    public void renameSheet(int index,
                            String newName)
                     throws IllegalArgumentException,
                            OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### renameSheet

    public void renameSheet(String oldName,
                            String newName)
                     throws IllegalArgumentException,
                            OfficeException

  Throws:
    `IllegalArgumentException`
    `OfficeException`

### copySheet

    public void copySheet(String origin,
                          String target,
                          int index)

### moveSheetToIndex

    public void moveSheetToIndex(String name,
                                 int index)

### insertNewSheet

    public void insertNewSheet(String name,
                               int index)

### removeSheet

    public void removeSheet(int index)
                     throws OfficeException

  Throws:
    `OfficeException`

### removeSheet

    public void removeSheet(String name)
                     throws OfficeException

  Throws:
    `OfficeException`

### getDocumentType

    public OODocType getDocumentType()

### print

    @Todo(value="doesn\'t work for new documents that are hidden")
    public void print(Map<?,?> printerProperties,
                                Map<?,?> jobProperties)
               throws IllegalArgumentException

  Specified by:
    `print` in interface `OfficeDocument`
  Overrides:
    `print` in class `AbstractOfficeDocument`
  Throws:
    `IllegalArgumentException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads