[Solved] Page properties - BackGraphic

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
lunter
Posts: 28
Joined: Fri May 29, 2009 9:16 am

[Solved] Page properties - BackGraphic

Post by lunter »

Is any way to uncheck File Link property in Page Style background properties?
When as store odt file with checked Link the background jpeg is no embeded into odt.

Code: Select all

 oStyle = oDoc.StyleFamilies.GetByName("PageStyles").GetByName("Standard")
 oStyle.BackGraphicURL = "file:///c:\bg.jpg"

 ' How to uncheck Link ? This property do not work.
 oStyle.BackGraphicLink = false
link.jpg
Last edited by TheGurkha on Mon Jan 24, 2011 10:08 pm, edited 3 times in total.
Reason: Tagged Solved, TheGurkha
OOo 3.3.X on MS Windows 7
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Page properties - BackGraphic

Post by Zizi64 »

Hi,

See this thread:
http://user.services.openoffice.org/en/ ... 20&t=31913
Maybe will help you...
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Page properties - BackGraphic

Post by hanya »

Here you are:

Code: Select all

Sub EmbedImageIntoPageBackground
  sURL = "file:///home/asuka/Documents/images/logo.png"
  sName = "Logo"
  
  oDoc = ThisComponent
  oBitmapTable = oDoc.createInstance("com.sun.star.drawing.BitmapTable")
  If NOT oBitmapTable.hasByName(sName) Then
    oBitmapTable.insertByName(sName, sURL)
  End If
  
  sInternalURL = oBitmapTable.getByName(sName)
  
  oStyleFamilies = oDoc.getStyleFamilies()
  oStyleFamily = oStyleFamilies.getByName("PageStyles")
  oStyle = oStyleFamily.getByName("Standard")
  oStyle.BackGraphicURL = sInternalURL
End Sub
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
lunter
Posts: 28
Joined: Fri May 29, 2009 9:16 am

Re: Page properties - BackGraphic

Post by lunter »

Thanks for the code!
OOo 3.3.X on MS Windows 7
Post Reply