Skip to content

Prevent a cell from being modified #454

@exfly

Description

@exfly

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
}

Activity

added a commit that references this issue on Aug 6, 2019
added a commit that references this issue on Aug 6, 2019
3599b24
xuri

xuri commented on Aug 7, 2019

@xuri
Member

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

added 2 commits that reference this issue on Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedThis issue can be reproduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @xuri@exfly

        Issue actions

          Prevent a cell from being modified · Issue #454 · qax-os/excelize