Spread WPF Documentation
Protect Property (Worksheet)
Example 


Gets or sets whether cells on this sheet that are marked as protected are uneditable.
Syntax
'Declaration
 
<System.ComponentModel.DefaultValueAttribute()>
Public Property Protect As System.Boolean
'Usage
 
Dim instance As Worksheet
Dim value As System.Boolean
 
instance.Protect = value
 
value = instance.Protect
[System.ComponentModel.DefaultValue()]
public System.bool Protect {get; set;}
Example
This example only allows certain cells to be edited.
gcSpreadSheet1.Sheets[0].Cells[1, 1].Locked = false;
gcSpreadSheet1.Sheets[0].Cells[1, 1].Text = "Locked";
gcSpreadSheet1.Sheets[0].Columns[3].Locked = false;
gcSpreadSheet1.Sheets[0].Rows[5].Locked = false;
gcSpreadSheet1.Protect = true;
gcSpreadSheet1.Sheets[0].Protect = true;
gcSpreadSheet1.Invalidate();

private void button1_Click(object sender, RoutedEventArgs e)
        {
gcSpreadSheet1.Sheets[0].Cells[1, 1].ResetLocked();
gcSpreadSheet1.Invalidate();
        }
GcSpreadSheet1.Sheets(0).Cells(1, 1).Locked = False
GcSpreadSheet1.Sheets(0).Cells(1, 1).Text = "Locked"
GcSpreadSheet1.Sheets(0).Columns(3).Locked = False
GcSpreadSheet1.Sheets(0).Rows(5).Locked = False
GcSpreadSheet1.Protect = True
GcSpreadSheet1.Sheets(0).Protect = True
GcSpreadSheet1.Invalidate()

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
GcSpreadSheet1.Sheets(0).Cells(1, 1).ResetLocked()
GcSpreadSheet1.Invalidate()
End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional (SP4), Windows XP (SP2), Windows 2008, Windows 2003 Server (SP1)

See Also

Reference

Worksheet Class
Worksheet Members

 

 


Copyright © GrapeCity, inc. All rights reserved.