Sub Main
Dim momDocument, maTable As Object
Dim cursCell as Object
monDocument = ThisComponent
maTable = monDocument.TextTables.getByName( "Tableau1" )
cursCell = maTable.createCursorByCellName( "A1" )
oGTP = CreateUnoService("com.sun.star.gallery.GalleryThemeProvider")
sName = "ACVF-A..D"
If oGTP.hasByName(sName) Then
oTheme = oGTP.getByName(sName)
nCount = oTheme.getCount()
oItem = oTheme.getByIndex(nCount -1)
// how to add the gallery image to the cell pointed by cursCell ?
End If
End Sub
Insert image with oItem.URL of the image URL by general way which is known and can be found in this forum through the API.
Is there any method that helps me to get a gallery item by name ?
I have not seen it.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
brunnerdan wrote:Is there any method that helps me to get a gallery item by name ?
Presuming by name, you meant title. The item's name (in a document) is not necessarily the same as the item's title (in the gallery). I used this code to get a gallery item by title.
Cache = CreateUnoService("com.sun.star.gallery.GalleryThemeProvider")
Theme = Cache.getByName("MyShapes")
For Nth = 0 To Theme.Count - 1
Shp = Theme(Nth)
If Shp.Title = "‹ShapeTitle›" Then Exit For
Next
Apache OpenOffice 4.1.11
LibreOffice 7.1.8 (x64)
Windows 10