We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Column Locking (programatically) in Desktop grid


Amjad

I have requested for a feature i.e. Column Locking. I was going through your conversation with Irfan about in which you gave following example:

The following code will lock all cells of row 4.

Style s = sheet.Rows[3].GetStyle();

s.CellLocked = true;

sheet.Rows[3].SetStyle(s);


With that we can lock all cells of a row. But I need to lock all cells of a column in one go. I know it's possible from GUI, Select a column->Right Click->Format Cells->Protection->Locked (As shown in attached file).

But I want to do it programatically. This is possible in the current version or you will provide this in future as I discussed with Irfan.

Hi

Please ignore it. I found the solution:

Dim lColStyle As Style
lColStyle = grdDataEntry.Worksheets(0).Columns(9).GetStyle
lColStyle.CellLocked = True
grdDataEntry.Worksheets(0).Columns(9).SetStyle(lColStyle)

Thanks

Hi

I was testing the code i implemented for Locking a Column. Unfortunately it fails in the case when i use certain key combinations. For eg. I was using the TAB+TILT+Numeric Keys. Pressing these key combination multiple times makes the locked column editable. Can you guys please provide me some appropriate solution for locking the whole column of the Aspose Grid. I am pasting a screen shot for this issue.

Code i am using is as follows:

Dim lColStyle As Style

lColStyle = grdGrid.Worksheets(0).Columns(lColIndex).GetStyle

lColStyle.CellLocked = True

grdGrid.Worksheets(0).Columns(lColIndex).SetStyle(lColStyle)

Thanks

Hi,

Well, I tried your scenario a bit, I did try to insert the values using your key combinations on a locked column cells and it works fine. I mean I cannot insert any value using the key combination (you provided) to the locked cell.

Could you elaborate and provide us complete details how could you insert the values (the key combinations), we will check it soon.

And which version of the GridDesktop control you are using? did you try v2.0.0.23?

Thank you.