Using styles I get it to work. It's a pity though that one can't simply set isLocked.
Graham On 19 July 2012 13:35, Johnny Rosenberg <[email protected]> wrote: > 2012/7/19 Graham Luffrum <[email protected]>: > > Hi, > > > > I am trying to write a macro that will, amongst other things, lock a > single > > cell in a Calc sheet. I can easily test to see if the cell is locked, > > using "CellProtection.IsLocked", but I don't see how to change the value. > > > > Any ideas? > > > > Graham > > I tried to just set IsLocked to False and True, but I guess you tried > that too, because nothing happened: > > > ThisComponent.getSheets().getByIndex(0).getCellByPosition(0,0).cellProtection.IsLocked=False > ' Nothing happens > > I found this thread in a forum, however: > http://user.services.openoffice.org/en/forum/viewtopic.php?f=9&t=34393 > > They also suggest to manipulate IsLocked, which obviously doesn't > work, at least not with LibreOffice Calc 3.5.5. However, they also > suggest using two different cell styles, one unlocked and one locked, > and apply them with a macro. I didn't test that, but take a look > yourself. > > Still, I wonder why IsLocked didn't work. On the other hand, if it > worked, I suppose there would be a method for it, like > CellProtection.Lock() or something like that. > > > Kind regards > > Johnny Rosenberg > ジョニー・ローゼンバーグ > > -- > For unsubscribe instructions e-mail to: [email protected] > Problems? > http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ > Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette > List archive: http://listarchives.libreoffice.org/global/users/ > All messages sent to this list will be publicly archived and cannot be > deleted > -- For unsubscribe instructions e-mail to: [email protected] Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
