ChartSheetBase.ProtectContents Özellik
Gösteren bir değeri alır mı içeriğini Microsoft.Office.Tools.Excel.ChartSheetBase korunuyor.
Ad alanı: Microsoft.Office.Tools.Excel
Derleme: Microsoft.Office.Tools.Excel.v4.0.Utilities (Microsoft.Office.Tools.Excel.v4.0.Utilities.dll içinde)
Sözdizimi
'Bildirim
Public ReadOnly Property ProtectContents As Boolean
Get
public bool ProtectContents { get; }
Özellik Değeri
Tür: System.Boolean
true içeriğini Microsoft.Office.Tools.Excel.ChartSheetBase korunuyor.
Açıklamalar
Bu tüm korur Microsoft.Office.Tools.Excel.ChartSheetBase.
Örnekler
Aşağıdaki kod örneği Protect yöntemi geçerli tüm içeriğini korumak için Microsoft.Office.Tools.Excel.ChartSheetBase. Sonra bu örnek kullanır ProtectContents grafik sayfası korunuyorsa ve kullanarak grafik sayfasından korumayı kaldırmak için kullanıcı ister doğrulamak için özellik Unprotect yöntemi.
Private Sub ChartSheetProtection()
Globals.Sheet1.Range("A1", "A5").Value2 = 22
Globals.Sheet1.Range("B1", "B5").Value2 = 55
Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
Excel.XlRowCol.xlColumns)
Me.ChartType = Excel.XlChartType.xl3DColumn
Me.Protect(DrawingObjects:=True, Contents:=True, _
Scenarios:=True, UserInterfaceOnly:=False)
If Me.ProtectContents Then
If DialogResult.Yes = MessageBox.Show("The chart sheet" & _
" is protected. Unprotect the chart sheet?", _
"Example", MessageBoxButtons.YesNo) Then
Me.Unprotect()
End If
End If
End Sub
private void ChartSheetProtection()
{
Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
Globals.Sheet1.Range["B1", "B5"].Value2 = 55;
this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
Excel.XlRowCol.xlColumns);
this.ChartType = Excel.XlChartType.xl3DColumn;
this.Protect(missing, true, true, true, false);
if (this.ProtectContents)
{
if (DialogResult.Yes ==
MessageBox.Show("The chart sheet is protected. " +
"Unprotect the chart sheet?", "Example",
MessageBoxButtons.YesNo))
{
this.Unprotect(missing);
}
}
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. kısmen güvenilir kod tarafından Kitaplıklar kullanma.