How to identify the readonly/editable cells on EnterCell event

Posted by: ajithedasseril on 17 January 2018, 1:49 am EST

    • Post Options:
    • Link

    Posted 17 January 2018, 1:49 am EST

    Hi,

    I have a scenario where the screenreader should read “readonly” if the cell is not editable. I want this behavior in the EnterCell event. The question is how can I identify a cell is Editable or not in the EnterCell event? The EditMode property will not work in the EnterCell event. I tried the Locked property also. But we can make an entire column locked and at that time the cell inside the column is showing Locked=false. Is there any other property which I can use for identifying the editable cells?

    Thanks

    Ajith

  • Posted 17 January 2018, 10:46 am EST

    Hi Ajith,

    You could use the isEditable() method of Spread Sheet Data Model. Here is the code you can use:

    
    FarPoint.Win.Spread.Model.ISheetDataModel isd;
    bool b;
    isd = (FarPoint.Win.Spread.Model.ISheetDataModel)fpSpread1.ActiveSheet.Models.Data;
    isd.SetValue(0, 0, "FarPoint");
    b = isd.IsEditable(0, 0);
    if (== true)
    {
    Label1.Text = "The value in the first cell can be edited";
    }
    else
    {
    Label1.Text = "The value in the first cell can not be edited";
    }
    
    
    

    Thanks,

    Deepak Sharma

  • Posted 18 January 2018, 7:27 am EST

    Hi Deepak,

    Unfortunately the isEditable() is not working if the entire column is locked. isEditable() method always returns true. Any other alternatives there?

    Thanks

    Ajith

  • Posted 19 January 2018, 10:27 am EST

    Hello,

    In that case you can use the code as follows:

    
       bool a, r, c;
                a = fpSpread1.Sheets[0].Cells[fpSpread1.ActiveSheet.ActiveRowIndex  , fpSpread1.ActiveSheet.ActiveColumnIndex].Locked;
                r = fpSpread1.Sheets[0].Rows[fpSpread1.ActiveSheet.ActiveRowIndex].Locked;
                c= fpSpread1.Sheets[0].Columns[fpSpread1.ActiveSheet.ActiveColumnIndex].Locked;
                if (a== true|| r== true|| c==true)
                {
                    MessageBox.Show("The cell can not be edited");
                }
                else
                {
                    MessageBox.Show("The cell can be edited");
                }
    
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels