Free Support Forum -

Locking worksheet and columns


How to lock both worksheets and columns in an excel sheet using aspose. The code which you have mentioned in your website is not working …Can you please help me out…



Please see the topic (especially the sub-topic i.e. “Protect a Column in the Worksheet”:

Thank you.

Hi ,

I want to lock the second column…but the code which i have written below is locking all the columns in the excel sheet except the second column…Please help me out…

Aspose.Cells.Style styleobj = new Aspose.Cells.Style();
styleobj = AsWorkSheetData.Cells.Columns[1].Style;
styleobj.IsLocked = false;

StyleFlag Flag=new StyleFlag();

AsWorkSheetData.Cells.Columns[1].ApplyStyle(styleobj, Flag);

styleobj = AsWorkSheetData.Cells[1].GetStyle();
styleobj.IsLocked = true;