Greetings;
I created an image, entered it to the gallery and wrote a macro which takes the gallery image and sets it as a background on each page of my document. That works fine.
However, there is no way to use the gallery to remove the background from each page. I know it can be manually done with Format/Page/Background setting the graphic back to color etc but I want to do this with a macro.
When I create the macro, it stops at the drop down list which asks for graphic or color. I tried the down arrow followed by a few TABs to get to the Ok button (avoiding mouse clicks) but no matter what I try the macro still stops at the drop down.
I have found a "quick and nasty" way to do this, simply by creating a blank image and using that as background but obviously this is not ideal. Any thoughts would be appreciated.
Mac OS X 10.11.4 OOo 4.1.1
Removing background from page with a macro
Removing background from page with a macro
OS X 10.11.4
OPen Office 4.1.1
OPen Office 4.1.1
Re: Removing background from page with a macro
I assume you set the image to be part of the Default Page Style. Does this do what you want?
Code: Select all
oStyleFamilies = ThisComponent.getStyleFamilies()
oPageStyle = oStyleFamilies.getByName("PageStyles")
oStd = oPageStyle.getByName("Standard")
oStd.BackGraphicURL = ""
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Removing background from page with a macro
II suppose, that you tried to record the macro but not to write. The macro recorder has a limited capability.When I create the macro, it stops at the drop down list which asks for graphic or color.
You need to study and use the API functions for your macros.
And suggest you to download, install and use one of the useful object inspection tools like the MRI or the XrayTool.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.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.
PortableApps/winPenPack: LO3.3.0-7.6.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.
Re: Removing background from page with a macro
I suggest you search the Macros and UNO API forum and check Andrew Pitonyak's book.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Removing background from page with a macro
Thanks everyone for posting replies.
Yes, Tibor was correct is assuming that I used the Record Macro function to "write" the macros. I have used this function very successfully in the past but obviously not where it involved selecting from a drop down menu.
I am not a programmer by any means so I tend to use provided tools only. I'll have a look at the suggested documentation. Thanks again.
Yes, Tibor was correct is assuming that I used the Record Macro function to "write" the macros. I have used this function very successfully in the past but obviously not where it involved selecting from a drop down menu.
I am not a programmer by any means so I tend to use provided tools only. I'll have a look at the suggested documentation. Thanks again.
OS X 10.11.4
OPen Office 4.1.1
OPen Office 4.1.1
Re: Removing background from page with a macro
The Record Macro can give an outline, but often needs the intricacies to be hand coded, based on either OO BASIC or the OO API.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS