BuiltInDocumentPropertiesTemplate Property

Gets or sets the informational name of the document template.

Namespace:  Aspose.Words.Properties
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.9.0

Syntax

public string Template { get; set; }

Property Value

Type: String

Remarks

In Microsoft Word, this property is for informational purposes only and usually contains only the file name of the template without the path.

Empty string means the document is attached to the Normal template.

To get or set the actual name of the attached template, use the AttachedTemplate property.

Examples

Shows how to work with document properties in the "Origin" category.
Document doc = new Document(MyDir + "Properties.docx");

// The properties we will work with are members of the BuiltInDocumentProperties attribute
BuiltInDocumentProperties properties = doc.BuiltInDocumentProperties;

// Since this document has been edited and printed in the past, values generated by Microsoft Word will appear here
// These values can be glanced at by right clicking the file in Windows Explorer, without actually opening the document
// Fields such as PRINTDATE, EDITTIME etc. can display these values inside the document
Console.WriteLine($"Created using {properties.NameOfApplication}, on {properties.CreatedTime}");
Console.WriteLine($"Minutes spent editing: {properties.TotalEditingTime}");
Console.WriteLine($"Date/time last printed: {properties.LastPrinted}");
Console.WriteLine($"Template document: {properties.Template}");

// We can set these properties ourselves
properties.Company = "Doe Ltd.";
properties.Manager = "Jane Doe";
properties.Version = 5;
properties.RevisionNumber++;

// If we plan on programmatically saving the document, we may record some details like this
properties.LastSavedBy = "John Doe";
properties.LastSavedTime = DateTime.Now;

// When right clicking the document file in Windows Explorer, these properties are found in Properties > Details > Origin
doc.Save(ArtifactsDir + "Properties.Origin.docx");

See Also