-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SaveAs(), unprotects all protected/locked cells #809
Comments
Thanks for your issue, I propose to change the struct type xlsxProtection struct {
Locked *bool `xml:"locked,attr"`
Hidden *bool `xml:"hidden,attr"`
} |
Hi @xuri I've applied the change you've suggested: But IDE is displaying this alert: In terminal I'm getting this same message too: /Users/david/go/pkg/mod/github.com/360!ent!sec!group-!skylar/excelize/[email protected]/styles.go:2475:21: cannot use style.Protection.Hidden (type bool) as type *bool in assignment |
I have fixed it, please try to use the master branch code, and this patch will be released in the next version. |
Hi @xuri thanks I can confirm, this is working well! |
i have the same problem, how resolved ? \github.com\xuri\excelize\[email protected]\styles.go:1297:30: cannot use *xf.Protection.Hidden (variable of type bool) as *bool value in assignment |
Description
If I create a new workbook, and set C3 and C4 cells as Hidden and Protected/Locked, when I save it as a new file using excelize 2.3.2, it removes the formula protection.
Test Excel: NewBook.xlsx
Steps to reproduce the issue:
Describe the results you received:
![image](https://user-images.githubusercontent.com/4760084/112239416-cced2a80-8c1c-11eb-848b-98266c6a71f3.png)
C4 and C5 should remain Hidden BUT NOT Locked:
Describe the results you expected:
![image](https://user-images.githubusercontent.com/4760084/112239193-6a942a00-8c1c-11eb-8803-2e9705bdcb95.png)
C4 and C5 should remain Hidden and Locked:
Environment details (OS, Microsoft Excel™ version, physical, etc.):
Mac OS Big Sur 11.2.2
go version go1.16.2 darwin/amd64
I did some investagion, and looks like issue occurs in xl/styles.xml
Excel 2010's xl/styles.xml:
Excelize 2.3.2's xl/styles.xml:
Excelize by default is adding locked="false" and MS Excel is not adding it.
Reviewing code https://github.com/360EntSecGroup-Skylar/excelize/blob/ab2c1c8fe1ef787c1f692bcf26c7bbe0cca2c5b3/xmlStyles.go#L53
looks like struct have a bool value, and like it is not especofied, go will set
false
by defaultI would like to help solving this issue, but I new in go and also I've started reviewing excelize code, so if you metnion which files needs to be modified and how to debug I can help resolving this issue.
Thanks in advance
The text was updated successfully, but these errors were encountered: