Examples of XText


Examples of com.sun.star.text.XText

        XInterface oObj = null;
        Object FieldMaster = null;
        XPropertySet PFieldMaster = null;
        XDependentTextField xTF = null;
        XEnumerationAccess xFEA = null;
        XText the_Text;
        XTextCursor the_Cursor;
        XTextContent the_Field;

        log.println( "creating a test environment" );
        XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
            UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDoc );

        try {
            FieldMaster = oDocMSF.createInstance
                ( "com.sun.star.text.FieldMaster.Database" );
            PFieldMaster = (XPropertySet) UnoRuntime.queryInterface
                (XPropertySet.class,(XInterface) FieldMaster);
            oObj = (XInterface)
                oDocMSF.createInstance("com.sun.star.text.TextField.Database");
            xTF = (XDependentTextField)
                UnoRuntime.queryInterface(XDependentTextField.class,oObj);
        } catch ( com.sun.star.uno.Exception e ) {
            e.printStackTrace(log);
        }

        try {
            PFieldMaster.setPropertyValue("DataBaseName","Bibliography");
            PFieldMaster.setPropertyValue("DataTableName","biblio");
            PFieldMaster.setPropertyValue("DataColumnName","Address");
        } catch ( com.sun.star.lang.WrappedTargetException e ) {
            log.println("Error: can't set PropertyValue to a FieldMaster");
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.IllegalArgumentException e ) {
            log.println("Error: can't set PropertyValue to a FieldMaster");
            e.printStackTrace(log);
        } catch ( com.sun.star.beans.UnknownPropertyException e ) {
            log.println("Error: can't set PropertyValue to a FieldMaster");
            e.printStackTrace(log);
        } catch ( com.sun.star.beans.PropertyVetoException e ) {
            log.println("Error: can't set PropertyValue to a FieldMaster");
            e.printStackTrace(log);
        }

        the_Text = xTextDoc.getText();
        the_Cursor = the_Text.createTextCursor();
        the_Field = (XTextContent)
            UnoRuntime.queryInterface(XTextContent.class, oObj);

        try {
            xTF.attachTextFieldMaster(PFieldMaster);
            the_Text.insertTextContent(the_Cursor,the_Field,false);
        } catch ( com.sun.star.lang.IllegalArgumentException e ) {
            e.printStackTrace(log);
            throw new StatusException( "Couldn't create TextField", e );
        }
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.