How can i lock a worksheet? #93

Closed
janhuehne opened this Issue May 18, 2012 · 8 comments

Comments

Projects
None yet
3 participants
Collaborator

janhuehne commented May 18, 2012

No description provided.

Owner

randym commented May 18, 2012

Hey @janhuehne

Do you mean lock people from editing or locking a column/row pane?

Collaborator

janhuehne commented May 18, 2012

Yes.

Owner

randym commented May 18, 2012

Lolz both?!!? I'll see what we have already and what needs to be done this weekend. If you have a sample of what your looking to do, please add it to this ticket.

Collaborator

janhuehne commented May 18, 2012

Yes ... I thinks it's the same.

By default all cells are locked, but to protect them from writing I have to lock the worksheet, too.

Owner

randym commented May 18, 2012

Cheers. I'll be in touch soon with a solution/example. Thanks for using axlsx!

Owner

randym commented May 20, 2012

@janhuehne

The basics for sheet protection have been implemented on master. However, I am having a bit of trouble implementing the password hashing as defined by the specification. So you can use this to enable sheet protection, but please dont us the password yet as excel is not returning the same hash and the sheet will be permanently locked.

Have a look at the following for info on what can be protected.
https://github.com/randym/axlsx/blob/master/lib/axlsx/workbook/worksheet/sheet_protection.rb

basically something like

ws = p.workbook.add_worksheet
ws.sheet_protection do |sp|
  sp.sheet = true
  sp.format_cells => false
end
Owner

randym commented May 23, 2012

Excellent work on that retro PW implementation. Ill keep this floating on stackoverflow
http://stackoverflow.com/questions/10694174/implement-ecma-376-sheetprotection-hashing-algorithm-in-ruby

In the hope that someone out there has been there, done that - and knows how to get this working according to the proper spec instead of one of the transitional exceptions. (assuming MS is even interested in this part....)

This will be released next week in 1.1.6

@randym randym closed this May 23, 2012

tried this, password removed when open the file with excel or numbers ( mac app )
screen shot 2017-05-03 at 4 43 18 pm
screen shot 2017-05-03 at 4 44 18 pm

@randym where did i miss?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment