Setting background image in Base form

It used to be so easy by using this line:


but it became deprecated with LibreOffice 6.1.

Now I am trying this code, and it runs without error but does not set the background image:


oPageStyle = ThisComponent.getStyleFamilies().getByName("PageStyles").getByName("Default Style")
oPageStyle.FillColor = RGB(255,255,255)
oPageStyle.BackGraphicLocation =

oProvider = createUnoService("")

Dim args(0) as new
args(0).Name = "URL"
args(0).Value = imgurl

oPageStyle.BackGraphic = oProvider.queryGraphic(args())

Testing in the end:

MsgBox isNull(oProvider.queryGraphic(args())) 'False
MsgBox isNull(oPageStyle.BackGraphic) 'True

No idea why, but using FillBitmap instead of BackGraphic seems to do the trick.

Possibly worth filing a bug report

Thanks, this works now! Will report it.