Package com.sun.star.table

Examples of com.sun.star.table.XCell


    * a double-value in the cell else it inserts a formula in the cell
    */
    public static void insertIntoCell(
        int CellX, int CellY, String theValue, XSpreadsheet TT1, String flag) {

        XCell oCell = null;

        try {
            oCell = TT1.getCellByPosition(CellX, CellY);
        } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
            System.out.println("Could not get Cell");
        }
        if (flag.equals("V")) {oCell.setValue((new Float(theValue)).floatValue());}
                   else {oCell.setFormula(theValue);}

    } // end of insertIntoCell
View Full Code Here


        log.println("ImplementationName " + utils.getImplName(oObj));

        TestEnvironment tEnv = new TestEnvironment( oObj );

        // relation for XAccessibleEventBroadcaster
        XCell xCell = null;
        final String text = "Text for testing of the interface XAccessibleText";
        try {
            XSpreadsheets oSheets = xSheetDoc.getSheets() ;
            XIndexAccess oIndexSheets = (XIndexAccess)
                UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
            XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
                    new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
            xCell = oSheet.getCellByPosition(5, 5) ;
            xCell.setFormula(text);
        } catch(com.sun.star.lang.WrappedTargetException e) {
            log.println("Exception ceating relation :");
            e.printStackTrace(log);
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            log.println("Exception ceating relation :");
            e.printStackTrace(log);
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            log.println("Exception ceating relation :");
            e.printStackTrace(log);
        }

        final XCell fCell = xCell ;

        tEnv.addObjRelation("EventProducer",
            new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
                public void fireEvent() {
                    fCell.setFormula("firing event");
                    fCell.setFormula(text);
                }
            });

        return tEnv;
    }
View Full Code Here

    * a double-value in the cell else it inserts a formula in the cell
    */
    public static void insertIntoCell(
        int CellX, int CellY, String theValue, XSpreadsheet TT1, String flag)
    {
        XCell oCell = null;

        try {
            oCell = TT1.getCellByPosition(CellX, CellY);
        } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
            System.out.println("Could not get Cell");
        }

        if (flag.equals("V")) {
            oCell.setValue(new Float(theValue).floatValue());
        } else {
            oCell.setFormula(theValue);
        }
    } // end of insertIntoCell
View Full Code Here

    * a double-value in the cell else it inserts a formula in the cell
    */
    public static void insertIntoCell(
        int CellX, int CellY, String theValue, XSpreadsheet TT1, String flag) {

        XCell oCell = null;

        try {
            oCell = TT1.getCellByPosition(CellX, CellY);
        } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
            System.out.println("Could not get Cell");
        }

        if (flag.equals("V")) {
            oCell.setValue(new Float(theValue).floatValue());
        } else {
            oCell.setFormula(theValue);
        }

    } // end of insertIntoCell
View Full Code Here

            }
        }
        return retval;
    }
    private String getCellName(XTextRange range)throws java.lang.Exception{
        XCell cell = UnoRuntime.queryInterface(XCell.class,range.getText());
        String retval = null;
        if (cell!=null){
            retval = (String) ((XPropertySet)UnoRuntime
                    .queryInterface(XPropertySet.class,cell))
                    .getPropertyValue("CellName");
View Full Code Here

    }
    private XTextTable getTable(XTextRange range) throws java.lang.Exception{
        // Iterate through tables and find a table with a
        // cell by that name that contains that cell
        XTextTable retval= null;
        XCell cell = UnoRuntime.queryInterface(XCell.class,range.getText());
        if (cell!=null){
            String cellname = (String) ((XPropertySet)UnoRuntime
                    .queryInterface(XPropertySet.class,cell))
                    .getPropertyValue("CellName");

            XTextTablesSupplier tableSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
            XNameAccess tablenames = tableSupplier.getTextTables();
            XIndexAccess tableindex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, tablenames);
            Logger.getLogger("com.CompPad").log(Level.FINE,"tableindex "+tableindex);
            for (int i=0; i < tableindex.getCount(); i++){
                XTextTable table = (XTextTable)UnoRuntime.queryInterface(XTextTable.class,tableindex.getByIndex(i));
                XCell tcell = table.getCellByName(cellname);
                if (tcell==cell){
                    // this is the cell we've been looking for!
                    Logger.getLogger("com.CompPad").log(Level.FINE,"FOUND!");
                    // get the xTextRange from the xTextContent of the xTextTable
                    retval = table;
View Full Code Here

            System.out.println(elemType.getTypeName());
            Object sheet = xSpreadsheets.getByName("MySheet");
            XSpreadsheet xSpreadsheet = (XSpreadsheet)UnoRuntime.queryInterface(
                XSpreadsheet.class, sheet);
            XCell xCell = xSpreadsheet.getCellByPosition(0, 0);
            xCell.setValue(21);
            xCell = xSpreadsheet.getCellByPosition(0, 1);
            xCell.setValue(21);
            xCell = xSpreadsheet.getCellByPosition(0, 2);
            xCell.setFormula("=sum(A1:A2)");
            XPropertySet xCellProps = (XPropertySet)UnoRuntime.queryInterface(
                XPropertySet.class, xCell);
            xCellProps.setPropertyValue("CellStyle", "Result");
            XModel xSpreadsheetModel = (XModel)UnoRuntime.queryInterface(
                XModel.class, xSpreadsheetComponent);
            XController xSpreadsheetController = xSpreadsheetModel.getCurrentController();
            XSpreadsheetView xSpreadsheetView = (XSpreadsheetView)
                UnoRuntime.queryInterface(XSpreadsheetView.class,
                                          xSpreadsheetController);
            xSpreadsheetView.setActiveSheet(xSpreadsheet);
            // *********************************************************
            // example for use of enum types
            xCellProps.setPropertyValue("VertJustify",
                                        com.sun.star.table.CellVertJustify.TOP);
            // *********************************************************
            // example for a sequence of PropertyValue structs
            // create an array with one PropertyValue struct, it contains
            // references only
            loadProps = new PropertyValue[1];
            // instantiate PropertyValue struct and set its member fields
            PropertyValue asTemplate = new PropertyValue();
            asTemplate.Name = "AsTemplate";
            asTemplate.Value = new Boolean(true);
            // assign PropertyValue struct to array of references for PropertyValue
            // structs
            loadProps[0] = asTemplate;
            // load calc file as template
            //xSpreadsheetComponent = xComponentLoader.loadComponentFromURL(
            //    "file:///c:/temp/DataAnalysys.ods", "_blank", 0, loadProps);
            // *********************************************************
            // example for use of XEnumerationAccess
            XCellRangesQuery xCellQuery = (XCellRangesQuery)
                UnoRuntime.queryInterface(XCellRangesQuery.class, sheet);
            XSheetCellRanges xFormulaCells = xCellQuery.queryContentCells(
                (short)com.sun.star.sheet.CellFlags.FORMULA);
            XEnumerationAccess xFormulas = xFormulaCells.getCells();
            XEnumeration xFormulaEnum = xFormulas.createEnumeration();
            while (xFormulaEnum.hasMoreElements()) {
                Object formulaCell = xFormulaEnum.nextElement();
                xCell = (XCell)UnoRuntime.queryInterface(XCell.class, formulaCell);
                XCellAddressable xCellAddress = (XCellAddressable)
                    UnoRuntime.queryInterface(XCellAddressable.class, xCell);
                System.out.println("Formula cell in column " +
                                   xCellAddress.getCellAddress().Column
                                   + ", row " + xCellAddress.getCellAddress().Row
                                   + " contains " + xCell.getFormula());
            }
        }
        catch (java.lang.Exception e){
            e.printStackTrace();
View Full Code Here

    private boolean assignCells(int _nColumn, boolean _bforce)
    {
        try
        {
            XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0);
            XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
            String CompString = "Column";
            XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
            if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce))
            {
View Full Code Here

        this.oTextTableHandler = _oTextTableHandler;
        this.CurDBMetaData = _CurDBMetaData;
        CurDBField = CurDBMetaData.getFieldColumnByFieldName(_FieldName);
        bIsGroupColumn = true;
        XTextRange xTextCell;
        XCell xCell;
        getTableColumns(TableName);

        XTableRows xRows = null;
        try
        {
View Full Code Here

        }

        XInterface oObj = null;

        // inserting some content to have non-empty page preview
        XCell xCell = null;
        try {
            XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
            XIndexAccess oIndexSheets = (XIndexAccess)
                UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
            Object o = oIndexSheets.getByIndex(0);
            XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject(
                            new com.sun.star.uno.Type(XSpreadsheet.class), o);
            xCell = oSheet.getCellByPosition(0, 0) ;
            xCell.setFormula("ScAccessiblePageHeader");

            xCell = oSheet.getCellByPosition(0, 1) ;
            xCell.setFormula("Cell 1");
            xCell = oSheet.getCellByPosition(0, 2) ;
            xCell.setFormula("Cell 2");
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            log.println("Exception ceating relation :");
            failed(e.getMessage());
        } catch(com.sun.star.lang.WrappedTargetException e) {
            log.println("Exception ceating relation :");
View Full Code Here

TOP

Related Classes of com.sun.star.table.XCell

Copyright © 2018 www.massapicom. 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.