Please use the ExportImages
button on the sheet.
Option Explicit
' Exports embedded images.
Sub ExportImages()
Dim oSheet As Object, oGraphicProvider As Object, oShape As Object, oDrawPage As Object, oCell As Object
Dim aProp(1) as new com.sun.star.beans.PropertyValue
Dim i As Long, n as Long, arr
oGraphicProvider=createUnoService("com.sun.star.graphic.GraphicProvider")
arr=Split(ThisComponent.URL, "/")
oSheet=ThisComponent.Sheets(0) ' first sheet of the current document
oDrawPage=oSheet.DrawPage
For i=0 To oDrawPage.Count-1
oShape=oDrawPage(i)
oCell=oShape.anchor
If HasUnoInterfaces(oCell, "com.sun.star.table.XCell") And oShape.supportsService("com.sun.star.drawing.GraphicObjectShape") Then
If Not (oShape.graphic Is Null) Then
aProp(0).Name = "URL"
arr(Ubound(arr))=oSheet.getCellbyPosition(0, oCell.cellAddress.row).String & ".png"
aProp(0).Value=Join(arr, "/")
aprop(1).Name="MimeType"
aprop(1).Value="image/png" ' https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1graphic_1_1GraphicDescriptor.html#a60fd10355a0ba590ab36a2aaae02455c
oGraphicProvider.storeGraphic oShape.graphic, aProp
n=n+1
End If
End If
Next i
Msgbox "Exported images: " & n
End Sub
ExportImages.ods (205.9 KB)