One field in the calc document should contain a picture (Menu : insert picture from file).
I can achieve this via a recorded macro which resides in the calc document itself.
However when trying this from a macro belonging to the database, nothing happens.
Code: Select all
Sub placeFoto
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(1).Name = "ToPoint"
args1(1).Value = "$C$7"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(3) as new com.sun.star.beans.PropertyValue
args2(1).Name = "FileName"
args2(1).Value = "file:///Volumes/DUVEL$DATA/Data/VRTDB/fotos/BART_HE.jpg"
args2(2).Name = "FilterName"
args2(2).Value = "JPEG - Joint Photographic Experts Group"
args2(3).Name = "AsLink"
args2(3).Value = true
dispatcher.executeDispatch(document, ".uno:InsertGraphic", "", 0, args2())
End Sub
Code: Select all
Cell = Sheet.getCellRangeByName("fNaam")
Cell.String = Namen.Naam
The examples from Andrew Pitonyak (5.9. Loading/Inserting an image into your document) do not work because
is not applicable to calc documents.oDoc.createInstance("com.sun.star.text.GraphicObject")
help !