Some posted this on a forum:
function fnOpenInputStream( sFileName as String ) as variant
dim oInputStream as object
dim sURL as String
dim oSFA as object
dim oInpDataStream as object
sUrl = ConvertToUrl(sFileName)
oSFA = createUNOService ("com.sun.star.ucb.SimpleFileAccess")
oInputStream = oSFA.openFileRead(sFileName)
oInpDataStream = createUNOService ("com.sun.star.io.DataInputStream")
oInpDataStream.setInputStream(oInputStream)
fnOpenInputStream = oInpDataStream
end function
oCtl.read(fnOpenInputStream( "c:\tmp\as0392.gif" ))
Where oCtl is the image control.
So I had this idea:
to replace oInputStream by: resultSet.getBinaryStream(8)
Yes I need the 8th column.
And then use:
oCtl.read(oInpDataStream)
However this does not work.
I have a clue on why:
getBinaryStream delivers a com.sun.star.io.XInputStream
and the ImageControl.read needs a:
com.sun.star.io.XObjectInputStream
But I have no clue on how to convert it to the class that is needed.
Any ideas?
On 5/18/06, Ross Johnson <[EMAIL PROTECTED]> wrote:
Willem Ligtenberg wrote:
> Hi,
>
> I'm writing a macro that performs a query on the database and puts the
> result of the query on screen (in a form). Since the query will result
> in only one result.
> I am able to display text and date fields. But I also want to be able
> to show a picture that is stored in the database. How do I get an
> ImageControl to display that image, which is stored in binary format
> in the database?
The Image Control should work fine (ref OOo 2.0.2 on Linux). I've only
used it on images that I've stored via the Image Control (right click
menu), so maybe that is important. Otherwise, it was set up much the
same as other controls, i.e. specify the data field on the Data tab, and
that's it.
Problems I did find were: storing images is very very slow for some
reason (may not be OOo's or the control's fault - I haven't tracked this
down yet), and; I would like better scaling/cropping options. Currently
all you can do is turn scaling on or off - which either distorts the
image if the image and frame have different aspect ratios, or clips the
image if the image is larger than the frame. I.e. neither option seems
optimal. So going the macro route may be the better way in the end.
Ross
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]