Free Support Forum -

Protecting columns

What would be the preferred/recommended method for protecting a column of cells? Should I create a range and manipulate that somehow? I see I can protect individual cells, but it doesn’t make sense I should need to loop through every cell in the column and specifically lock it down.

Is there a way to just protect a column by itself (from resizing/editing, etc).


The forums were down yesterday and had asked a similar question. I received the following response…

Yes. Aspose.Excel supports to protect worksheet from being editable. Please refer to
Laurence Chen
Lead Developer
Aspose Nanjing Team

While this is somewhat helpful, I need to only lock down specific columns and not the entire spreadsheet. When I use the following line of code…


The entire sheet becomes locked down from editing. I have marked the cells I need to be locked as IsLocked=true.

How do I make the IsLocked property be in effect?

btw, I am saving my Excel file as Excel 97. That might be germane to the discussion.


To lock just a column, you can try these.

1. In MS Excel, manually create a designer spreadsheet(template).
2. Select the whole worksheet and unlock all cells.
3. Select the desired column and lock it.
4. Save the file.
5. Use Aspose.Excel to import it.
6. Call this line of code:excel.Worksheets[0].Protect(ProtectionType.All);
7.Save the result file.

Then you can get it.