Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


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 users+help@libreoffice.org
List archive: http://listarchives.libreoffice.org/www/users/
*** All posts to this list are publicly archived for eternity ***

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.