Download it now!
Bug 127025 - Background image of Writer form cannot be set using the BackGraphic property
Summary: Background image of Writer form cannot be set using the BackGraphic property
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2019-08-19 12:02 UTC by Balint Fodor
Modified: 2019-09-05 07:25 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Balint Fodor 2019-08-19 12:02:14 UTC
Before LibreOffice 6.1 one could use BackGraphicURL to set the background image.
Now BackGraphic should be used, but it doesn't work.
FillBitmap works instead.

Full code:


    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

Actual Results:
No image displayed

Expected Results:
Image should be displayed.

Reproducible: Always

User Profile Reset: No

Additional Info:
Comment 1 Alex Thurgood 2019-09-03 14:48:53 UTC
If I try and run this macro in LO5.4.7.2, I get the following error (in French) :

BASIC runtime error.
Property or method not found : BackGraphic.

So the method wasn't available then, or it was called something slightly different.

I also had to correct your use of "Default Style" to "Style par défaut" in order to avoid an error on this line :

oPageStyle = ThisComponent.getStyleFamilies().getByName("PageStyles").getByName("Style par défaut")

In 6.1, when I run the macro with the tests at the end I get TRUE in the MsgBox. No image is inserted.

I'm not a Basic expert, so can't say what is wrong with your macro when testing in my French language version of LO.
Comment 2 Balint Fodor 2019-09-03 14:57:01 UTC
You get True in both MsgBox-es? That's even worse result than what I got, since both terms are null. Have you checked if your image's URL is correct?
Comment 3 Alex Thurgood 2019-09-03 15:04:04 UTC
Yes, I checked the image URL was correct, but I still get True for both MsgBoxes in LO6252, for example.

Inevitably linked to Tomaz' changes, so adding him to CC.

@Tomaz : any advice here ?