# How to Hide/Disable some Toolbar features after Sheet Protection

**URL:** <https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233>\
**Category:** Development\
**Created:** [December 15, 2024, 12:36pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233 "2024-12-15T12:36:15Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 15, 2024, 12:36pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/1 "2024-12-15T12:36:15Z")

</div>

Hi , I am using calc since long and got bit addicted and making advanced user forms and data management sheet, but recently I found that when we Protect Sheet leaving some cell unprotected, all functions of toolbar work properly on those unprotected cell.

Now the issue come here, Either there should be a feature like while protecting sheet , all function of toolbar should be allowed to be freeze like selecting protected and unprotected or by default features all features of toolbar should be freeze. If not allowed , owner of the worksheet doesn’t get full control and user may change the structure and formatting of the cell allowed to unprotected to fill the data.

I also tried lots of another way and referred the docs like

[Theming of Collabora Online — SDK https://sdk.collaboraonline.com/ documentation](https://sdk.collaboraonline.com/docs/theming.html)

and

[https://help.collaboraoffice.com/latest/en-US/text/sbasic/shared/03/sf\_toolbar.html?DbPAR=BASIC#bm\_id81611339709014](https://help.collaboraoffice.com/latest/en-US/text/sbasic/shared/03/sf_toolbar.html?DbPAR=BASIC#bm_id81611339709014)

and even tried using scriptforge with below code but none of them worked

def hide\_feature\_toolbars():  
# Create the Basic and Document service  
bas = CreateScriptService(“Basic”)  
doc = CreateScriptService(“Document”, bas.ThisComponent)

```
# Get the list of all available toolbars
arr_toolbars = doc.Toolbars()

# Loop through each toolbar and hide it
for toolbar_name in arr_toolbars:
    toolbar = doc.Toolbars(toolbar_name)
    toolbar.Visible = False

```

Looking forward for an early help. Thanks in advanced

 ![2](https://europe1.discourse-cdn.com/flex013/uploads/collaboraonline/original/2X/4/4c0d77b650d9cadcb2655d18eadf1d9554ddc841.png)  
 ![1](https://europe1.discourse-cdn.com/flex013/uploads/collaboraonline/original/2X/7/743c5f1c60ce38b81700c6b3728415e6da1a1aa7.png)

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 16, 2024, 11:44am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/2 "2024-12-16T11:44:49Z")

</div>

Hello @ANKUSHJAIN91

> [@Hiding UNO elements](https://forum.collaboraonline.com/t/hiding-uno-elements/2754/2):
>
> Hi, The Hide\_Command post message works with UNO commands. It is used like Hide\_Menu\_Item, but takes a uno command instead. You can hide “Theme” from the menus or notebook bar with the Hide\_Command and id set to .uno:ThemeDialog. It should hide menu, toolbar buttons and notebook bar buttons. Not all items have an associated UNO command though. Hub

try this and let me know how things goes 😉

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 16, 2024, 11:53am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/3 "2024-12-16T11:53:43Z")

</div>

Hi, @darshan  
Thanks for replying. I tried the Uno commands but I was not able to execute in my python environment, surprisingly where script forge is working uno commands are not working. Please provide any Guide on UNO commands environment setup. Thanks

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 16, 2024, 12:00pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/4 "2024-12-16T12:00:10Z")

</div>

Have you seen our sdk example of integration for different web app ?

> **[collabora-online-sdk-examples/webapp/python at master ·...](https://github.com/CollaboraOnline/collabora-online-sdk-examples/tree/master/webapp/python)**
>
> Various minor pieces of code to be used in Collabora Online and related software - CollaboraOnline/collabora-online-sdk-examples

> I tried the Uno commands but I was not able to execute in my python environment, surprisingly where script forge is working uno commands are not working. Please provide any Guide on UNO commands environment setup

What is the error ? which instruction are you following for the env setup ? can you mention that ?

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 16, 2024, 12:04pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/5 "2024-12-16T12:04:52Z")

</div>

Actually I am using embed python scripts in ods file. Do we need to create python environment for it in collabora online docker container for that ? And our customize function from application/ system macros option ?

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 16, 2024, 12:22pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/6 "2024-12-16T12:22:00Z")

</div>

#### **1. Embedded Python Scripts**

- Python scripts embedded in ODS files are stored as part of the document itself and are executed within the **LibreOffice runtime** provided by the Collabora Online Docker container.
- This means you don’t need a separate Python environment for running these scripts. They use the Python runtime already present in the Collabora Online environment.

#### **2. Executing System/Application Macros**

- **System and application macros are typically not executed directly in Collabora Online for security reasons. By default, executing macros is restricted in a web-based environment.**
- If you need to run customized functions, you’ll need to:
  - Ensure macros are allowed in the Collabora Online configuration.
  - Embed your Python script as a **document macro** in the ODS file itself.

- Embedding Python Scripts\*\*

1. Open the ODS file in LibreOffice Desktop (not in Collabora Online).
2. Go to `Tools > Macros > Organize Macros > Python`.
3. Select `My Macros` or `Document` macros, depending on where you want the script stored.
4. Write your Python script in the editor.

- Enable Macro Execution in Collabora Online\*\*

**By default, macros may not be allowed in Collabora Online. To enable them:**

1. Edit the `coolwsd.xml` configuration file in your Collabora Online Docker container.
2. Locate the `<macros>` section and set:

FYI:  
**Security restrictions in Collabora Online limit what embedded macros can do. Avoid using macros that require high-level system access or file manipulation.**

@ANKUSHJAIN91 this is all i have in my pocket feel free to try if this work All the best 🙂  
Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 20, 2024, 9:00am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/7 "2024-12-20T09:00:15Z")

</div>

Thanks a lot @darshan for sharing such knowledgeful resources , I have successfully create more than 20 function in python using script forge in past few months after enabling macros from coolwsd.xml. .

Please have a look on my basic macros and tell where I am lacking or going wrong:-

Sub HideRevealFrameObjects  
Dim xCurrentController as Object  
Dim xLayoutManager as Object  
xCurrentController = ThisComponent.CurrentController  
Rem If in design mode just exit routine  
If xCurrentController.isFormDesignMode Then  
Exit Sub  
End If  
doc = ThisComponent  
frame = doc.CurrentController.Frame  
lmgr = frame.LayoutManager  
Rem Now set each item to be hidden (or revealed)  
Rem Standard toolbar to be hidden  
lmgr.hideElement(“private:resource/toolbar/standardbar”)  
lmgr.hideElement(“private:resource/toolbar/singlemode”)  
lmgr.hideElement(“private:resource/toolbar/singlemode-cell”)  
lmgr.hideElement(“private:resource/menubar/menubar”)  
lmgr.hideElement(“private:resource/statusbar/statusbar”)  
Rem Standard toolbar to be revealed (would do if previously hidden)  
’ lmgr.showElement(“private:resource/toolbar/standardbar”) ’  
End Sub

This code perfectly works fine in libre office, but not working in Collab environment.

Also I tried below code with UNO but it also not able to hide the toolbar and menubar

Sub HideToolbar  
Dim oDoc As Object  
Dim oFrame As Object  
Dim oDispatcher As Object

```
' Get the current document and frame
oDoc = ThisComponent
oFrame = oDoc.CurrentController.Frame

' Create the dispatcher
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

' Arguments to hide the toolbar
Dim args(0) As New com.sun.star.beans.PropertyValue
args(0).Name = "Hide"
args(0).Value = True
' Hide the "Standard" toolbar (change .uno:ToolbarStandard to the desired toolbar command)
oDispatcher.executeDispatch(oFrame, ".uno:hideMenubar", "", 0, args())

```

End Sub

Also I found below function in collab code but not able to figure our how to use it hide the toolbar or menubar

```
hideMenubar: function() {
	this._menubarShouldBeHidden = true;
	if (this.isMenubarHidden() || this.shouldUseNotebookbarMode())
		return;

	var notebookbarWasCollapsed = this.isNotebookbarCollapsed();
	this.extendNotebookbar(); // The notebookbar has the button to show the menu bar, so having it hidden at the same time softlocks you
	this._notebookbarShouldBeCollapsed = notebookbarWasCollapsed;

	$('.main-nav').hide();
	if (L.Params.closeButtonEnabled) {
		$('#closebuttonwrapper').hide();
		$('#closebuttonwrapperseparator').hide();
	}
	const obj = document.getElementById('fold-button');
	obj.style.transform = 'rotate(180deg)';

	$('#fold').prop('title', _('Show Menu'));
},

```

and

```
collapseNotebookbar: function() {
	this._notebookbarShouldBeCollapsed = true;

	if (this.isNotebookbarCollapsed() || this.isMenubarHidden())
		return;

	this.moveObjectVertically($('#formulabar'), -1);
	$('#toolbar-wrapper').css('display', 'none');

	$('#document-container').addClass('tabs-collapsed');

	this.map._docLayer._syncTileContainerSize();
},

```

Actually, I want to hide/disable the clearcontent and other formatting function from menubar and toolbar and short short cut keys because they are working on unprotected cell which I don’t want to allow user when sheet is protected.

@darshan ,

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 20, 2024, 9:02am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/8 "2024-12-20T09:02:22Z")

</div>

@darshan , It will be grateful if a sample code to use this Hide\_Menu\_Item is available that can be run from basic macros in collab environment. Thanks

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 20, 2024, 10:15am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/9 "2024-12-20T10:15:41Z")

</div>

Hi @ANKUSHJAIN91,

Thank you for sharing your detailed progress! While I’ll take some time to review your case, I kindly encourage you to explore additional options, as questions of this type often require in-depth exploration on the user’s end.

Let’s also consider discussing this on Matrix so others can provide input—it’s a great way to find collaborative solutions!

If possible try to join COOL weekly so we can discuss some ideas with community ? does that sounds okay to you ?

Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 20, 2024, 11:44am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/10 "2024-12-20T11:44:09Z")

</div>

@darshan I appreciate your guidance to connect with Cool weekly meeting and I was about to join it yesterday, but couldn’t get connected due to some reason. I have explored all features and read the docs several times, and what I have figured out that menu and toolbar of collab work diff and both architecture are different. I need it to fix this asap as I have stuck in this since last 1 week and need to complete this to deliver the sheet to someone and next cool weekly meeting to far and also its Christmas.  
I was checking doc if the hide menubar function in image can be triggered from macros , but could not find solution for it. Any help on this will also work!!!

 ![a](https://europe1.discourse-cdn.com/flex013/uploads/collaboraonline/original/2X/3/32a8617c0a2d55c5e7b96ed0c139c6f7eb3137f1.png)

Thanks for Support and guidance.

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 20, 2024, 11:53am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/11 "2024-12-20T11:53:19Z")

</div>

Hi @ANKUSHJAIN91,

Thanks for your continued effort in exploring solutions! It’s great to see your dedication. May I ask what kind of business you’re in and how you plan to use this functionality? If you’re comfortable sharing, understanding your use case might help us provide more targeted guidance.

It’s currently Christmas & the New Year break; nevertheless, Collabora keeps a live support team working across the holidays to solve urgent issues for partners and paying customers. If you need this level of support, I strongly recommend:

1. [Becoming a partner](https://www.collaboraoffice.com/become-partner/)
2. Getting a [support contract](https://www.collaboraoffice.com/subscriptions/)
3. Filing tickets in the [support portal](https://www.collaboraoffice.com/partner-client-portal/)

If you can share more about your use case or commercial requirements—like the specifics of your integration or deployment—we’d be happy to see if additional guidance can help.

Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 20, 2024, 12:02pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/12 "2024-12-20T12:02:12Z")

</div>

I am Professional Accountant and a part time full stack developer and right now I need it for some use in my office task where sheet need to be shared with one small client who will feed the data in customized sheet provided by me. .

Yes, I would like to join the partnership program helping collab to boost, but need a bit support from expert like your team where many news features can be build in this including AI

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 20, 2024, 12:10pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/13 "2024-12-20T12:10:38Z")

</div>

Wow, that’s absolutely awesome to hear! Joining the partnership program and collaborating to boost Collabora, especially with innovative features like AI, sounds incredibly exciting. 🙌

I strongly encourage you to send an email detailing your ideas and the issues you’re currently facing to our sales team. They can connect you with our integration experts, who will be more than happy to assist you in building out these fantastic features. Your vision could lead to something truly groundbreaking for both your firm and Collabora!

It’s truly inspiring to see your enthusiasm for creating and growing together—we can’t wait to see what amazing contributions you bring to the table!

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 20, 2024, 12:29pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/14 "2024-12-20T12:29:03Z")

</div>

Thanks a lot @darshan for providing this opportunity.

Here is the detailed use case:- I have created user form which is connect to API with help python. I want to send the data to our server. Since sheet which is in form type some cell need to be left unprotected to allow user to fill the data. but irony is that for unprotected cell all formatting and clear content is allowed which has prospect of user to remove data validation put on those cell . We just want user to allow to fill data not to alter any other setting in the sheet. It will be very helpful If I could keep toolbar & menu bar hidden or freeze through macros for a particular sheet or at least hide some function like clear content , other formatting.

Thanks Again !!

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 20, 2024, 12:37pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/15 "2024-12-20T12:37:58Z")

</div>

@ANKUSHJAIN91 have you sent the detail to the Support team ?

---

<div class="post-metadata">

**Author:** ![ANKUSHJAIN91](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@ANKUSHJAIN91](https://forum.collaboraonline.com/u/ANKUSHJAIN91)\
**Post date:** [December 20, 2024, 1:59pm UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/16 "2024-12-20T13:59:10Z")

</div>

I think that is a paid one ? Right !

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 21, 2024, 6:10am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/17 "2024-12-21T06:10:15Z")

</div>

@ANKUSHJAIN91 Yes, it is a paid program, and we recommend it because of your urgent requirement. Given the current limitations in resources, this ensures priority support and access to our expert integration team, who can help implement the features you need. Our sales team can guide you further—feel free to reach out!

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [December 21, 2024, 9:31am UTC](https://forum.collaboraonline.com/t/how-to-hide-disable-some-toolbar-features-after-sheet-protection/3233/18 "2024-12-21T09:31:06Z")

</div>


