Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / NamedStyle Class / Locked Property

In This Topic
    Locked Property (NamedStyle)
    In This Topic
    Gets or sets whether this style permits a cell to be edited.
    Public Overrides Property Locked As Boolean
    Dim instance As NamedStyle
    Dim value As Boolean
    instance.Locked = value
    value = instance.Locked
    public override bool Locked {get; set;}

    Property Value

    true if cells are marked as locked; false otherwise

    You can specify that certain cells are locked; that is, the user cannot edit them. You mark cells as locked using this property. Cells are not locked until the SheetView object's Protect property is set to true for the sheet. Because the Protect property's default value is true, unless you have changed the value of the Protect property, when you mark a cell as locked, it is locked and the user cannot edit it.

    Note that when the Protect property is false, the user can still interact with cells marked as locked.

    This example creates a new custom style and sets several of the style properties.
    FarPoint.Web.Spread.NamedStyle nstyleheaders = new FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault");
    ns.BackColor = Color.LightBlue;
    ns.Border = new FarPoint.Web.Spread.Border(Color.Red);
    ns.CellType = new FarPoint.Web.Spread.TextCellType();
    ns.Editor = new FarPoint.Web.Spread.TextCellType();
    ns.Font.Bold = true;
    ns.ForeColor = Color.Red;
    ns.Formatter = new FarPoint.Web.Spread.TextCellType();
    ns.HorizontalAlign = HorizontalAlign.Left;
    ns.Locked = true;
    ns.Name = "StyleData";
    ns.Parent = "DataAreaDefault";
    ns.Renderer = new FarPoint.Web.Spread.TextCellType();
    ns.VerticalAlign = VerticalAlign.Bottom;
    FpSpread1.ActiveSheetView.Cells[0, 0].StyleName = "StyleData";
    FpSpread1.ActiveSheetView.SetText(0, 0, "NamedStyle");
    FpSpread1.ActiveSheetView.Columns[0].Width = 120;
    FpSpread1.ActiveSheetView.Rows[0].Height = 80;
    Dim ns As New FarPoint.Web.Spread.NamedStyle("StyleData", "DataAreaDefault")
    ns.BackColor = Color.LightBlue
    ns.Border = New FarPoint.Web.Spread.Border(Color.Red)
    ns.CellType = New FarPoint.Web.Spread.TextCellType
    ns.Editor = New FarPoint.Web.Spread.TextCellType
    ns.Font.Bold = True
    ns.ForeColor = Color.Red
    ns.Formatter = New FarPoint.Web.Spread.TextCellType
    ns.HorizontalAlign = HorizontalAlign.Left
    ns.Locked = True
    ns.Name = "StyleData"
    ns.Parent = "DataAreaDefault"
    ns.Renderer = New FarPoint.Web.Spread.TextCellType
    ns.VerticalAlign = VerticalAlign.Bottom
    FpSpread1.ActiveSheetView.Cells(0, 0).StyleName = "StyleData"
    FpSpread1.ActiveSheetView.SetText(0, 0, "NamedStyle")
    FpSpread1.ActiveSheetView.Columns(0).Width = 120
    FpSpread1.ActiveSheetView.Rows(0).Height = 80
    See Also