DocumentBase.Type Property

 

Gets the document type (template or document).

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

public WdDocumentType Type { get; }

Property Value

Type: Microsoft.Office.Interop.Word.WdDocumentType

One of the WdDocumentType values.

The following code example displays a message that shows the document type. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentType()
{
    switch (this.Type)
    {
        case Word.WdDocumentType.wdTypeDocument:
            MessageBox.Show("The document is a normal" +
            "  Word document.");
            break;

        case Word.WdDocumentType.wdTypeFrameset:
            MessageBox.Show("The document is a frameset.");
            break;

        case Word.WdDocumentType.wdTypeTemplate:
            MessageBox.Show("The document is a template.");
            break;

        default:
            MessageBox.Show("The document type could not" +
                " be discovered.");
            break;
    }
}
Return to top
Show: