Hi Robert,
Robert Vojta schrieb:
On Wed, Aug 27, 2008 at 2:04 PM, Peter Eberlein
<[EMAIL PROTECTED]> wrote:

Hi Peter,

I tried it in Java ...

public class GraphicHelper
{
        /**
         * Creates XGraphic from byte[] array.
         *
         * @param connection OpenOffice.org connection.
         * @param imageData Image data.
         * @return XGraphic object with image or null if an error occurs.
         */
        public static XGraphic createGraphic( OfficeConnection connection,
byte[] imageData )
        {
                try
                {
                        Object oGraphicProvider = connection.createInstance(
"com.sun.star.graphic.GraphicProvider" );
                        XGraphicProvider provider = ( XGraphicProvider )
UnoRuntime.queryInterface( XGraphicProvider.class, oGraphicProvider );
                        Props properties = new Props();
                        properties.put( "InputStream", new 
ByteArrayInputStream( imageData ) );
                        return provider.queryGraphic( 
properties.toPropertyValueArray() );                      
                }

a ByteArrayInputStream isn't a XInputStream, which you need there, I think,

Regards

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to