Page 1 of 1
[Solved] Make header/footer read-only
Posted: Mon Mar 24, 2025 6:59 am
by Samuel
[Solved] Hi i am able to create header/footer through java but i am not able to make it read-only. Is there any method or libraries for the same?
Re: Is there anyway to make the header/footer read-only?
Posted: Mon Mar 24, 2025 8:56 am
by Hagar Delest
Not that I know of, directly.
Not tested: you can try to insert a section in the header/footer and protect it.
Please add
[Solved] at the beginning of the title in your
first post (top of the topic) with the
✎ button if your issue has been fixed.
Re: Is there anyway to make the header/footer read-only?
Posted: Mon Mar 24, 2025 10:01 am
by keme
Another untested strategy, if Hagar's suggestion does not help you:
It may be possible to protect the entire document, but have an inserted section which is editable.
I don't know how to do either programmatically, though. Hopefully you'll find out.
Re: Is there anyway to make the header/footer read-only?
Posted: Mon Mar 24, 2025 11:26 pm
by JeJe
With a mousehandler and keyhandler you can intercept mouse and key presses and prevent their action eg by testing to see if the text has the ImplementationName SwXHeadFootText.
Re: Is there anyway to make the header/footer read-only?
Posted: Tue Mar 25, 2025 12:47 am
by Lupp
There is a different approach. See attached example. I made it with LibO 25.2.1. In AOO menu paths and setting dialogs are different, but you will easily find what you need.
Re: Is there anyway to make the header/footer read-only?
Posted: Tue Mar 25, 2025 3:37 am
by Samuel
ThankYou guys for the replies, was able to make it read only by adding the header/footer in a text section and used isProtected property to protect it and prevent editing.
Re: [Solved] Is there anyway to make the header/footer read-only?
Posted: Tue Mar 25, 2025 1:17 pm
by JeJe
As a cosmetic enhancement you could add, on each page, a form controls label anchored to the page, with blank text so it is invisible (so long as the form controls design mode is off). Using the label to cover from the bottom of the header to the top of the page and extending it to the page edges you can stop clicking in the header to edit it.
Edit: and also, if you wanted, the blank label is a method of adding a tooltip for where it covers.