Ask Your Question
0

Macro including a background image [closed]

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

allais19 gravatar image

updated 2020-08-14 15:06:20 +0200

Alex Kemp gravatar image

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

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-08-14 15:06:41.840492

1 Answer

Sort by » oldest newest most voted
0

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

JohnSUN gravatar image

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

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( "com.sun.star.drawing.BitmapTable" )
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 = com.sun.star.style.GraphicLocation.AREA
REM Now just apply style "First Page" to your document
End Sub
edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 278 times

Last updated: Aug 28 '14