Skip to content
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

Prevent a cell from being modified #454

Closed
exfly opened this issue Aug 1, 2019 · 1 comment
Closed

Prevent a cell from being modified #454

exfly opened this issue Aug 1, 2019 · 1 comment
Labels
confirmed This issue can be reproduced

Comments

@exfly
Copy link

exfly commented Aug 1, 2019

Description

I want to revent a sheet from being modified.

Steps to reproduce the issue:

  1. open protect worksheet
  2. select Set column format Set row format Select locked cells Select unlocked cells
  3. Want to can modify Modify cell width,but can not modify cell value
  4. I fork the this lib. the add API GetProtectSheet, read the FormatSheetProtection, then set the save field which is true. but it not works.

Describe the results you received:

protect all, I can not modify modify cell width

Describe the results you expected:

can modify Modify cell width,but can not modify cell value

Output of go version:

go version go1.12.6 darwin/amd64

Excelize version or commit ID:

9279c86d85ab0077f3696b8ec4cfb49ad8222530

Environment details (OS, Microsoft Excel™ version, physical, etc.):

mac:
Darwin localhost 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

excel:
v16.16.12(190715)

func (f *File) GetProtect(sheet string) (*FormatSheetProtection, error) {
	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return nil, err
	}
	var ret FormatSheetProtection
	ret.AutoFilter = xlsx.SheetProtection.AutoFilter
	ret.DeleteColumns = xlsx.SheetProtection.DeleteColumns
	ret.DeleteRows = xlsx.SheetProtection.DeleteRows
	ret.FormatCells = xlsx.SheetProtection.FormatCells
	ret.FormatColumns = xlsx.SheetProtection.FormatColumns
	ret.FormatRows = xlsx.SheetProtection.FormatRows
	ret.InsertColumns = xlsx.SheetProtection.InsertColumns
	ret.InsertHyperlinks = xlsx.SheetProtection.InsertHyperlinks
	ret.InsertRows = xlsx.SheetProtection.InsertRows
	ret.EditObjects = xlsx.SheetProtection.Objects
	ret.PivotTables = xlsx.SheetProtection.PivotTables
	ret.EditScenarios = xlsx.SheetProtection.Scenarios
	ret.SelectLockedCells = xlsx.SheetProtection.SelectLockedCells
	ret.SelectUnlockedCells = xlsx.SheetProtection.SelectUnlockedCells
	ret.Sort = xlsx.SheetProtection.Sort
	return &ret, err
}
@xuri xuri added the confirmed This issue can be reproduced label Aug 5, 2019
WuXu1995 added a commit to WuXu1995/excelize that referenced this issue Aug 6, 2019
xuri added a commit that referenced this issue Aug 6, 2019
@xuri
Copy link
Member

xuri commented Aug 7, 2019

Hi @exfly, this issue has been fixed. Please try to upgrade the library with the master branch code.

@xuri xuri closed this as completed Aug 7, 2019
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants