Ask Your Question

Setting background image in Base form

asked 2019-08-16 13:59:20 +0200

fodorbalint gravatar image

updated 2019-08-17 11:09:09 +0200

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
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-08-17 15:02:29 +0200

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

edit flag offensive delete link more


Possibly worth filing a bug report...

Mike Kaganski gravatar imageMike Kaganski ( 2019-08-17 15:03:05 +0200 )edit

Thanks, this works now! Will report it.

fodorbalint gravatar imagefodorbalint ( 2019-08-17 18:01:33 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-08-16 13:59:20 +0200

Seen: 101 times

Last updated: Aug 17 '19