获取一个值,该值指定某一元素或特性对于附加的架构是否有效。
命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)
语法
声明
ReadOnly Property ValidationStatus As WdXMLValidationStatus
    Get
WdXMLValidationStatus ValidationStatus { get; }
属性值
类型:Microsoft.Office.Interop.Word.WdXMLValidationStatus
WdXMLValidationStatus 值之一。
备注
ValidationStatus 属性可以为下列 WdXMLValidationStatus 值之一:
- wdXMLValidationStatusCustom 指示使用了 SetValidationError 方法来将 ValidationErrorText 属性设置为自定义的文本字符串。 
- wdXMLValidationStatusOK 指示某个 XML 元素或特性对于附加的架构有效。 
尽管 ValidationStatus 属性只允许使用这两个指定常数,但随 Microsoft Office Word 包含的 MSXML 5.0 组件中提供了其他许多未指定的值。
示例
下面的代码示例设置 XMLNode 的文本值,并通过使用 Validate 方法对该节点进行验证。 然后,此示例使用 ValidationStatus 属性确定此节点是否已验证。 如果该节点尚未验证,则此示例将使用 ValidationErrorText 属性显示验证错误信息。 此示例假定当前文档包含一个名为 CustomerAddress1Node 的 XMLNode。 如果 CustomerAddress1Node 映射到具有整数数据类型的架构元素,则验证将失败。
Private Sub ValidateNode()
    Me.CustomerAddress1Node.NodeText = "Nineteen Hundred"
    Me.CustomerAddress1Node.Validate()
    If Me.CustomerAddress1Node.ValidationStatus = _
        Word.WdXMLValidationStatus.wdXMLValidationStatusOK Then
        MsgBox("'" & Me.CustomerAddress1Node.BaseName & "' validates.")
    Else
        MsgBox("'" & Me.CustomerAddress1Node.BaseName & _
            "': " & Me.CustomerAddress1Node.ValidationErrorText(False))
    End If
End Sub
private void ValidateNode()
{
    this.CustomerAddress1Node.NodeText = "Nineteen Hundred";
    this.CustomerAddress1Node.Validate();
    if (this.CustomerAddress1Node.ValidationStatus ==
        Word.WdXMLValidationStatus.wdXMLValidationStatusOK)
    {
        MessageBox.Show("'" + this.CustomerAddress1Node.BaseName +
            "' validates.");
    }
    else
    {
        MessageBox.Show("'" + this.CustomerAddress1Node.BaseName +
            "': " + this.CustomerAddress1Node.ValidationErrorText[false]);
    }
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。