ChartSheet.ProtectContents 속성
Microsoft.Office.Tools.Excel.ChartSheet의 내용이 보호되는지 여부를 나타내는 값을 가져옵니다.
네임스페이스: Microsoft.Office.Tools.Excel
어셈블리: Microsoft.Office.Tools.Excel.v4.0.Utilities(Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Microsoft.Office.Tools.Excel(Microsoft.Office.Tools.Excel.dll)
구문
‘선언
ReadOnly Property ProtectContents As Boolean
bool ProtectContents { get; }
속성 값
형식: System.Boolean
Microsoft.Office.Tools.Excel.ChartSheet의 내용이 보호되는 경우 true입니다.
설명
전체 Microsoft.Office.Tools.Excel.ChartSheet가 보호됩니다.
예제
다음 코드 예제에서는 Protect 메서드를 사용하여 현재 Microsoft.Office.Tools.Excel.ChartSheet의 모든 내용을 보호합니다. 그런 다음 ProtectContents 속성을 사용하여 차트 시트가 보호되는지 확인한 후 Unprotect 메서드를 사용하여 사용자에게 차트 시트의 보호를 제거하도록 요청하는 프롬프트를 표시합니다.
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(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();
}
}
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.