Locking worksheet

Hi Team,

What is good way programmatically to lock (by style) all columns in worksheet only by worksheet name.
Not to protect - just lock.

Please help.

Thank you,
pa

@rudolfkalik,

Thanks for your query.

In MS Excel (new) sheet, all the cells in the worksheet are set to locked (by default). See the following sample code segments for your needs for your reference:
e.g
Sample code:

Worksheet ws = workbook.Worksheets[0];
 
            foreach (Aspose.Cells.Column wsColumn in ws.Cells.Columns)
            {
                Aspose.Cells.Style style = wsColumn.Style;
                style.IsLocked = true;
                StyleFlag styleFlag = new StyleFlag();
                styleFlag.Locked = true;
                wsColumn.ApplyStyle(style, styleFlag);
            }
2.
    Worksheet sheet = workbook.Worksheets[0];
    			Style style;
    			StyleFlag flag;
    			
    			style = workbook.CreateStyle();     
    			style.IsLocked = true;
    			flag = new StyleFlag();
    			flag.Locked = true;
    			sheet.Cells.ApplyStyle(style, flag);

Hope, this helps a bit.