Examples of XSpreadsheet


Examples of com.sun.star.sheet.XSpreadsheet

    /*
     * This method gets the first Sheet of the SpreadsheetDocument
     *
     */
    protected XSpreadsheet getSpreadsheet() {
        XSpreadsheet oSheet = null;

        log.println("getting sheets");

        XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets();

View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

    /**
    * Test calls the method and checks returned value. <p>
    * Has <b> OK </b> status if returned value isn't null. <p>
    */
    public void _getSpreadsheet(){
        XSpreadsheet oSheet = oObj.getSpreadsheet();
        tRes.tested("getSpreadsheet()", oSheet != null);
    }
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

       
        log.println("adding a valid listener");
        listener = new MyListener();
        oObj.addActivationEventListener(listener);

        XSpreadsheet org = xSpreadsheetView.getActiveSheet();
        xSpreadsheetView.setActiveSheet(two);

        if (!listenerCalled) {
            log.println("Listener wasn't called");
        }
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

    public void _removeActivationEventListener() {
        requiredMethod("addActivationEventListener()");
        listenerCalled = false;
        oObj.removeActivationEventListener(listener);

        XSpreadsheet org = xSpreadsheetView.getActiveSheet();
        xSpreadsheetView.setActiveSheet(two);

        if (listenerCalled) {
            log.println("Listener was called eventhough it is removed");
        }
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

            throw new StatusException( "Couldn't create document", e );
        }

        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));
                }
        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
            e.printStackTrace();
            throw new StatusException("Couldn't fill some cells", e);
        }
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

        XSpreadsheetDocument xSheetDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface(
                                                 XSpreadsheetDocument.class,
                                                 tEnv.getObjRelation(
                                                         "DOCUMENT"));
        String[] sheetNames = xSheetDoc.getSheets().getElementNames();
        XSpreadsheet xSheet = null;
        XCell xCell = null;

        try {
            xSheet = (XSpreadsheet) UnoRuntime.queryInterface(
                             XSpreadsheet.class,
                             xSheetDoc.getSheets().getByName(sheetNames[0]));
            xCell = xSheet.getCellByPosition(0, 0);
        } catch (com.sun.star.container.NoSuchElementException e) {
            e.printStackTrace();
        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
            e.printStackTrace();
        } catch (com.sun.star.lang.WrappedTargetException e) {
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

        log.println("checking that formula was set correctly...");
        XCellRangeAddressable crAddr =
            (XCellRangeAddressable)
                 UnoRuntime.queryInterface(XCellRangeAddressable.class, oObj);
        CellRangeAddress addr = crAddr.getRangeAddress() ;
        XSpreadsheet oSheet = (XSpreadsheet)tEnv.getObjRelation("SHEET");
        if (oSheet == null) throw new StatusException(Status.failed
            ("Relation 'SHEET' not found"));

        XCell oCell = null;
        double value;

        for (int i = addr.StartColumn; i <= addr.EndColumn; i++)
            for (int j = addr.StartRow; j <= addr.EndRow; j++) {
                try {
                    oCell = oSheet.getCellByPosition(i, j);
                } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
                    e.printStackTrace(log);
                    result = false;
                    break;
                }
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

    * </ul>
    */
    public void _setActiveSheet() {
        requiredMethod("getActiveSheet()");

        XSpreadsheet new_Sheet = (XSpreadsheet)tEnv.getObjRelation("Sheet");
        if (new_Sheet == null) throw new StatusException(Status.failed
            ("Relation 'Sheet' not found"));

        oObj.setActiveSheet(new_Sheet);
        new_Sheet = oObj.getActiveSheet();
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

    public void _collapseToCurrentRegion(){
        boolean bResult = true;
        int width = 4, height = 4;
        int leftCol = -1, topRow = -1;

        XSpreadsheet oSheet = oObj.getSpreadsheet();
        ((XSheetOperation) UnoRuntime.queryInterface(
            XSheetOperation.class, oSheet) ).clearContents(65535);
        oObj.collapseToCurrentRegion();
        int cols = ((XColumnRowRange)
            UnoRuntime.queryInterface(
                XColumnRowRange.class, oObj) ).getColumns().getCount();
        int rows = ((XColumnRowRange)
            UnoRuntime.queryInterface(
                XColumnRowRange.class, oObj) ).getRows().getCount();

        if (cols != width || rows != height) {
            bResult = false ;
            log.println("After collapseToCurrentRegion()"
                 + " call Region must have size " + width + "x" + height
                 + " but it is " + cols + "x" + rows);
        }

        // if previous test was successful try more complicated case
        if (bResult) {
            if (leftCol != -1 && topRow != -1) {
                try {
                    oSheet.getCellByPosition(
                        leftCol + width, topRow + height).setValue(1);
                } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
                    log.print("Can't get cell by position:");
                    e.printStackTrace(log);
                    bResult = false;
View Full Code Here

Examples of com.sun.star.sheet.XSpreadsheet

        int leftCol = 0, topRow = 0 ;

        boolean bResult = true ;

        log.println("DB: Starting collapseToMergedArea() method test ...") ;
        XSpreadsheet oSheet = oObj.getSpreadsheet() ;
        log.println ("DB: got Spreadsheet.") ;

        XCellRange newRange = null;
        try {
            newRange = oSheet.getCellRangeByPosition (
                leftCol + width - 1, topRow + height - 1,
                leftCol + width, topRow + height );
        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
            log.println("Can't get cell range by position");
            e.printStackTrace(log);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.