allirpa ,
this is soem code how it can be done from images in a database
for images stored on disc change the input stream URL to a file URL
hope it helps
Fernand
' finds which rows in the DataSourceBrowser are selected by the user
Dim frame1 As Object, frame2 As Object
Dim oModel As Object, oRowset As Object
Dim oDocument As Object, oGrid As Object
Dim oDataSourceBrowser as Object
Dim oSelection as Variant, ii As Long
oDoc = thiscomponent
oDocument = thiscomponent
frame1 = oDocument.CurrentController.Frame
frame2 = frame1.findFrame("_beamer",4) ' get DataBrowser frame
if IsNull(frame2) then
MsgBox("Beamer not found !", 16)
Exit Sub
end if
oDataSourcebrowser = frame2.Controller
' the DataSourceBrowser object has several getModel methods
' choose getModel from interface com.sun.star.awt.XTabController
' to get the form used by DataSourceBrowser
oModel = oDataSourcebrowser.com_sun_star_awt_XTabController_getModel
' creating a "clone" of the form
oRowset = oModel.createResultSet
oGrid = oDataSourceBrowser.CurrentControl
oSelection = oGrid.Selection
if UBound(oSelection) >= 0 then ' we get a list of Bookmarks
For ii= 0 To UBound(oSelection) and bStop <> true
if oRowset.moveToBookmark(oSelection(ii)) then
' MsgBox( oRowset.Columns(0).String & " : " &
oRowset.Columns(4).String )
else
MsgBox("Bookmark not found : " & oSelection(ii), 16)
exit sub
end if
oStream = oRowset.Columns(1).getbinarystream(1)
REM Author: Stephan Wunderlich. Two lines added by ms777 and completed
by Fernand
Dim oShape
Dim oProvider 'GraphicProvider service.
oShape = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
oGraphic = oDoc.createInstance("com.sun.star.text.GraphicObject")
oDoc.getDrawPage().add(oShape)
oProvider = createUnoService("com.sun.star.graphic.GraphicProvider")
Dim oProps(0) as new com.sun.star.beans.PropertyValue
oProps(0).Name = "InputStream"
oProps(0).Value = oStream
' oProps(0).Name = "URL"
' oProps(0).Value = sGraphicURL
oShape.Graphic = oProvider.queryGraphic(oProps())
oGraphic.GraphicUrl = oShape.GraphicUrl
' Insert at the current cursor location
oDOc.text.insertTextContent(oDoc.getCurrentController().getViewCursor(),
oGraphic, false)
' We no longer require the shape object.
oDoc.getDrawPage().remove(oShape)
wrote:
is there even a way on how to convert an applet to be able to insert it to an
open office document?
here's the scenario: I have an addon button in open office writer that opens
an applet when clicked.
when I close the button, the graphics rendered in the applet must be
transferred to the document.
is this possible?
any help is greatly appreciated.
thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org