共用方式為


DocumentBase.AttachedTemplate Property

Definition

Gets or sets a Template that represents the template attached to the document.

public:
 property System::Object ^ AttachedTemplate { System::Object ^ get(); void set(System::Object ^ value); };
public object AttachedTemplate { get; set; }
member this.AttachedTemplate : obj with get, set
Public Property AttachedTemplate As Object

Property Value

A Template that represents the template attached to the document.

Examples

The following code example displays a message that shows the name of the template that is attached to the document. To use this example, run it from the ThisDocument class in a document-level project.

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

Remarks

To set this property, specify either the name of the template or an expression that returns a Template.

Applies to