LO Calc Macro Api Protect without Select Protected Cells

Hi to all,

when i need to protect via api a lo calc sheet i only do something like

sh = ThisComponent.CurrentController.getActiveSheet()
sh.protect(passwd)
sh.unprotect(passwd)

But how can i protect the sheet with the option DO NOT SELECT PROTECTED CELLS like you can do it from the interface?
I can’t find an api to do this…

Thank You!

Hi

I believe the API does not allow it…

I created the report there 4 years ago but it is classified low enhancement and is not assigned.

Regards

Bad news so… At least I’m not so dumb for not being able to do that… :slight_smile:

@PYS

I need to protect some range of Calc cells by LO BASIC.

Is it available now ?

Hi @lonk

Protecting cells by LOBasic was and remains possible. What does not exist are API methods for fine-tuning rights management (selection, insertion, deletion). That being said, protect and unprotect by an instruction of the type :

oSheet.Protect("foo")
oSheet.unProtect("foo")

does not overwrite “manually” permissions set in the interface. So you shouldn’t have any problems…

Regards

That being said, protect and unprotect by an instruction does not overwrite “manually” permissions set in the interface

… but note that if a document is unprotected, then saved and reloaded, then the protection settings are lost (the settings are not stored to unprotected document’s file). Also note that keeping the settings when unprotecting then protecting only works since version 5.3 (commit).