Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1425
XamSpreadsheet 14.2, Locking a cell not working
posted

I'm trying to setup "non modifiable" column headers so that users can cut/paste or edit to provide values on worksheets. I have successfully set the first row to Frozen, but I also want to protect the cells that contains the column headers so that users cannot modify or delete the cells, but the following code does not work.

worksheet = project.MyWorkbook.Worksheets.Add("historical_injectivity.txt");
worksheet.Protected = true;
for (int i = 0; i < 2.Count; i++)
   {
    worksheet.Rows[0].Cells[i].CellFormat.Locked = ExcelDefaultableBoolean.True;
   }

Can you offer any help?

  • 35319
    posted

    Hello,

     

    I am just checking if you require any further assistance on the matter.

  • 35319
    posted

    Hi Michael,

     

    Thank you for your post. I have been looking into your concerns and currently this functionality is implemented only on Workbook level. It means that it is not implemented to work when loading the work book in XamSpreadsheet control. This feature will be implemented to our next version of the product(vol. 15.1).

     

    The desired behavior could be easily achieved by handling the ‘EditModeEntering’ event of the XamSpreadsheet control and cancelling it for the first row(header row) of the work sheet like e.g.:

     

            private void xamSpreadsheet1_EditModeEntering(object sender, Infragistics.Controls.Grids.SpreadsheetEditModeEnteringEventArgs e)

            {

                if (e.Cell.Row == 0)

                {

                    e.Cancel = true;

                }

            }

     

    Let me know, if you need any further assistance on this matter.