共用方式為


DocumentBase.DocumentInspectors Property

Gets a Microsoft.Office.Core.DocumentInspectors object that you can use to locate hidden personal information, such as author name, company name, and revision date.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property DocumentInspectors As DocumentInspectors
public DocumentInspectors DocumentInspectors { get; }

Property Value

Type: Microsoft.Office.Core.DocumentInspectors
A Microsoft.Office.Core.DocumentInspectors object that you can use to locate hidden personal information, such as author name, company name, and revision date.

Examples

The following code example iterates through the document inspectors. The code inspects each inspector and shows a message box that displays the name of the inspector, and the status and results of the inspection. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub GetDocumentInspectors()
    For Each insp As Office.DocumentInspector In Me.DocumentInspectors
        Dim status As Office.MsoDocInspectorStatus
        Dim results As String = String.Empty
        insp.Inspect(status, results)
        MessageBox.Show("Inspector Name: " + insp.Name + vbCrLf _
            + "Status: " + status.ToString() + vbCrLf + "Results: " _
            + results)
    Next 
End Sub
private void GetDocumentInspectors()
{
    foreach (Office.DocumentInspector insp in this.DocumentInspectors)
    {
        Office.MsoDocInspectorStatus status;
        string results = String.Empty;
        insp.Inspect(out status, out results);
        MessageBox.Show("Inspector Name: " + insp.Name + "\r\nStatus: " 
            + status.ToString() + "\r\nResults: " + results);
    }
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace