Hello Folks,I am attempting to run the following JAVA code via the 3.3 SDK... The idea is to remove elements from the Picture area of the document storage...

----

XStorageBasedDocument xStorageBasedDocument = (XStorageBasedDocument) UnoRuntime.queryInterface( XStorageBasedDocument.class, xWriterComponent_swriter_dest);

        Object oDocStorage = xStorageBasedDocument.getDocumentStorage();

        XStorage xStorage =
                (XStorage) UnoRuntime.queryInterface(XStorage.class,
                oDocStorage);

XNameAccess xDocStorageNameAccess = (XNameAccess) UnoRuntime.queryInterface(
                XNameAccess.class, oDocStorage);

        if (xDocStorageNameAccess.hasByName("Pictures")) {
            // if image is not there, Pictures directory also is not there
Object oPicturesStorage = xDocStorageNameAccess.getByName("Pictures");

XNameAccess xPicturesNameAccess = (XNameAccess) UnoRuntime.queryInterface(
                    XNameAccess.class, oPicturesStorage);

            // get names of the images
            // these names have their file extension
            String aNames[] = xPicturesNameAccess.getElementNames();

            for (int i = 0; i < aNames.length; i++) {
if ((aNames[i].contains("jpg") == true) || (aNames[i].contains("png") == true)) {
                    xStorage.removeElement(aNames[i]);
                }
            }

----

When running the code however I receive the following runtime error:

SEVERE: com.sun.star.container.NoSuchElementException: /Users/thb/source/libo_3.3/build/libreoffice-3.3.0.4/package/source/xstor/xstorage.cxx: :3330; at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:177) at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:143) at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:335) at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:304) at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:91) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:639) at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:151) at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:133)
        at $Proxy148.removeElement(Unknown Source)

--
Unsubscribe instructions: E-mail to [email protected]
List archive: http://listarchives.libreoffice.org/www/users/
*** All posts to this list are publicly archived for eternity ***

Reply via email to