DocumentBase.AttachedTemplate 属性

定义

获取或设置一个表示附加到文档的模板的 Template

public object AttachedTemplate { get; set; }

属性值

Object

一个表示附加到文档的模板的 Template

示例

下面的代码示例显示一条消息,该消息显示附加到文档的模板的名称。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void DocumentAttachedTemplate()
{
    Word.Template attachedTemplate = (Word.Template)this.AttachedTemplate;
    MessageBox.Show(attachedTemplate.Name);
}
Private Sub DocumentAttachedTemplate()
    Dim attachedTemplate As Word.Template = CType(Me.AttachedTemplate, Word.Template)
    MessageBox.Show(attachedTemplate.Name)
End Sub

注解

若要设置此属性,请指定模板的名称或返回的表达式 Template

适用于