Ask Your Question

Macro including a background image

asked 2014-08-27 12:49:07 +0100

allais19 gravatar image

Sample Macro including a background image (png file ...) in a title page?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-08-27 16:13:36 +0100

JohnSUN gravatar image

updated 2014-08-28 09:38:03 +0100

May be so?

Sub InsertBackgroundImage
Dim oStyleFamilies As Variant
Dim oPageStyles As Variant
Dim oFirstPageStyle As Variant
Dim oBitmaps
REM 1. Insert image into document (folder Pictures in ZIP)
    oBitmaps = ThisComponent.createInstance( "" )
REM First parameter - internal name of image, second - real path to file on disc
    oBitmaps.insertByName( "newBkg", ConvertToURL("C:\Test\BkgImage.png") )
REM 2. Get stile of title page
    oStyleFamilies = ThisComponent.getStyleFamilies()
    oPageStyles = oStyleFamilies.getByName("PageStyles")
    oFirstPageStyle = oPageStyles.getByName("First Page")
REM 3. Set URL of internal image as BackGraphicURL
    oFirstPageStyle.BackGraphicURL = oBitmaps.getByName("newBkg")
    oFirstPageStyle.BackGraphicLocation =
REM Now just apply style "First Page" to your document
End Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-08-27 12:49:07 +0100

Seen: 249 times

Last updated: Aug 28 '14