Skip to content

Can we make cell read-only conditionally? #103

Answered by anmcgrath
sankarkumar23 asked this question in Q&A
Discussion options

You must be logged in to vote

I'll have a look at why my suggestion didn't work, but glad you found a solution.

I saw your previous edit, if you want to conditionally limit the ability to edit cells you can do something like this:

        Sheet.Editor.BeforeCellEdit += (sender, args) =>
        {
            if (args.Cell.ValueType == CellValueType.Number)
            {
                if (args.Cell.GetValue<double>() > 0)
                    args.CancelEdit = true;
            }
        };

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@sankarkumar23
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by sankarkumar23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants