Personal tools
You are here: Home Forum Nice Office Access (NOA) Bild einfügen

 • Bild einfügen

Replies: 1   Views: 108
Up one level

 • Bild einfügen

Posted by OliverT at 2011-05-31 10:44:43
Hallo,

beim einfügen eines GraphicInfo Objektes erhalte ich folgende Fehlermeldung:

Exception in thread "main" ag.ion.bion.officelayer.text.TextException:
at ag.ion.bion.officelayer.internal.text.TextContentService.constructNewImage(TextContentService.java:203)
at oonoa.Main.main(Main.java:101)
Caused by: com.sun.star.container.NoSuchElementException:
at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:177)

Die Exception wird an fett markierter Stelle geworfen:


code:

            boolean useStream = false;
            GraphicInfo graphicInfo = null;

            System.out.println(new File("D:/t.gif").exists());
            String imagePath = new File("D:/t.gif").getAbsolutePath();
            int pixelWidth = 50;
            int pixelHeight = 50;

            if (!useStream) {
                //with url
                graphicInfo = new GraphicInfo(imagePath, pixelWidth, true, pixelHeight, true,
                        VertOrientation.TOP, HoriOrientation.LEFT,
                        TextContentAnchorType.AT_PARAGRAPH);
                

                
            } else {
                //with stream
                graphicInfo = new GraphicInfo(new FileInputStream(imagePath), pixelWidth,
                        true, pixelHeight, true, VertOrientation.TOP, HoriOrientation.LEFT,
                        TextContentAnchorType.AT_PARAGRAPH);
            }


            System.out.println(graphicInfo.getUrl());
            ITextContentService textContentService = textDocument.getTextService().getTextContentService();




ITextDocumentImage textDocumentImage = textContentService.constructNewImage(graphicInfo);

Vielen Dank!
OliverT Member
Posts: 2

 • Re: Bild einfügen

Posted by OliverT at 2011-05-31 11:06:18
Hallo,

ein Patch in der init Methode der GraphicInfo Klasse bringt den erwünschten Erfolg:

if (!this.url.contains("file:///";))
this.url = this.url.replaceFirst("file:/", "file:///";);
OliverT Member
Posts: 2

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: