コード例 #1
0
ファイル: AutoSave.java プロジェクト: zzz99977/core
  // create a calc document with content, which needs some time for saving
  private XInterface createBigCalcDoc() {
    m_aLog.log(Protocol.TYPE_SCOPE_OPEN, "createBigCalcDoc() started ...");
    try {
      m_aLog.log("Create empty calc document for testing.");
      XSpreadsheetDocument xSheetDoc = m_aSOF.createCalcDoc("_default");
      m_aLog.log("Retrieve first sheet from calc document.");
      XSpreadsheets xSheets = xSheetDoc.getSheets();
      XSpreadsheet xSheet =
          (XSpreadsheet)
              AnyConverter.toObject(
                  new Type(XSpreadsheet.class), xSheets.getByName(xSheets.getElementNames()[0]));
      m_aLog.log("Fill two cells with value and formula.");
      xSheet.getCellByPosition(0, 0).setValue(1);
      xSheet.getCellByPosition(0, 1).setFormula("=a1+1");
      m_aLog.log("Retrieve big range.");
      XCellRange xRange = xSheet.getCellRangeByName("A1:Z9999");
      XCellSeries xSeries = UnoRuntime.queryInterface(XCellSeries.class, xRange);
      m_aLog.log("Duplicate cells from top to bottom inside range.");
      xSeries.fillAuto(FillDirection.TO_BOTTOM, 2);
      m_aLog.log("Duplicate cells from left to right inside range.");
      xSeries.fillAuto(FillDirection.TO_RIGHT, 1);

      m_aLog.log(Protocol.TYPE_SCOPE_CLOSE | Protocol.TYPE_OK, "createBigCalcDoc() finished.");
      return xSheetDoc;
    } catch (Throwable ex) {
      m_aLog.log(ex);
    }

    m_aLog.log(Protocol.TYPE_SCOPE_CLOSE, "createBigCalcDoc() finished.");
    return null;
  }