sCellAdress.Row = 8;
log.println ("Getting a sheet");
XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets ();
XSpreadsheet oSheet = null;
XSpreadsheet oSheet2 = null;
XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface (
XIndexAccess.class, xSpreadsheets);
try
{
oSheet = (XSpreadsheet) AnyConverter.toObject (
new Type (XSpreadsheet.class),
oIndexAccess.getByIndex (0));
oSheet2 = (XSpreadsheet) AnyConverter.toObject (
new Type (XSpreadsheet.class),
oIndexAccess.getByIndex (1));
}
catch (com.sun.star.lang.WrappedTargetException e)
{
e.printStackTrace ();
throw new StatusException ("Couldn't get a spreadsheet", e);
}
catch (com.sun.star.lang.IndexOutOfBoundsException e)
{
e.printStackTrace ();
throw new StatusException ("Couldn't get a spreadsheet", e);
}
catch (com.sun.star.lang.IllegalArgumentException e)
{
e.printStackTrace ();
throw new StatusException ("Couldn't get a spreadsheet", e);
}
try
{
log.println ("Filling a table");
for (int i = 1; i < mMaxFieldIndex; i++)
{
oSheet.getCellByPosition (i, 0).setFormula ("Col" + i);
oSheet.getCellByPosition (0, i).setFormula ("Row" + i);
oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i);
oSheet2.getCellByPosition (0, i).setFormula ("Row" + i);
}
for (int i = 1; i < mMaxFieldIndex; i++)
{
for (int j = 1; j < mMaxFieldIndex; j++)
{
oSheet.getCellByPosition (i, j).setValue (i * (j + 1));
oSheet2.getCellByPosition (i, j).setValue (i * (j + 2));
}
}
oSheet.getCellByPosition (1, 1).setFormula ("aName");
oSheet.getCellByPosition (1, 2).setFormula ("otherName");