log.println("getting sheets");
XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
log.println("getting a sheet");
XSpreadsheet oSheet = null;
XIndexAccess oIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
try {
oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e);
}
testdoc = utils.getFullTestDocName("ScDDELinksObj.sdc");
log.println("filling some cells");
try {
oSheet.getCellByPosition(5, 5).setFormula(
"=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
oSheet.getCellByPosition(1, 4).setFormula(
"=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
oSheet.getCellByPosition(2, 0).setFormula(
"=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log);
throw new StatusException(
"Exception occurred while filling cells", e);