xSheetDoc);
XController xController = xModel.getCurrentController();
//setting value of cell A1
XCell xCell = null;
try {
log.println("Getting spreadsheet");
XSpreadsheets oSheets = xSheetDoc.getSheets();
XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(
XIndexAccess.class, oSheets);
XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),
oIndexSheets.getByIndex(0));
log.println("Getting a cell from sheet");
xCell = oSheet.getCellByPosition(0, 0);
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log);
throw new StatusException(
"Error getting cell object from spreadsheet document", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log);
throw new StatusException(
"Error getting cell object from spreadsheet document", e);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace(log);
throw new StatusException(
"Error getting cell object from spreadsheet document", e);
}
xCell.setFormula("Value");
//setting property 'PrintHeaders' of the style 'Default'
XStyleFamiliesSupplier xSFS = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(
XStyleFamiliesSupplier.class,
xSheetDoc);