Share via


WordprocessingDocument.CreateFromTemplate Method

Definition

Overloads

CreateFromTemplate(String)

Creates an editable WordprocessingDocument from a template, opened on a MemoryStream with expandable capacity. The template will be attached to the WordprocessingDocument.

CreateFromTemplate(String, Boolean)

Creates an editable WordprocessingDocument from a template, opened on a MemoryStream with expandable capacity.

CreateFromTemplate(String)

Creates an editable WordprocessingDocument from a template, opened on a MemoryStream with expandable capacity. The template will be attached to the WordprocessingDocument.

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument CreateFromTemplate (string path);
static member CreateFromTemplate : string -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function CreateFromTemplate (path As String) As WordprocessingDocument

Parameters

path
String

The path and file name of the template.

Returns

The new WordprocessingDocument based on and linked to the template.

Remarks

Attaching the template has been chosen as the default behavior because this is also what happens when a document is created from a template (other than Normal.dotm) using Microsoft Word.

Applies to

CreateFromTemplate(String, Boolean)

Creates an editable WordprocessingDocument from a template, opened on a MemoryStream with expandable capacity.

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument CreateFromTemplate (string path, bool isTemplateAttached);
static member CreateFromTemplate : string * bool -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function CreateFromTemplate (path As String, isTemplateAttached As Boolean) As WordprocessingDocument

Parameters

path
String

The path and file name of the template.

isTemplateAttached
Boolean

True, if the template should be attached to the document.

Returns

The new WordprocessingDocument based on and linked to the template.

Remarks

This method is provided to offer the choice to not attach the template. When templates are attached in Microsoft Word, for example, the absolute path will be used in the relationship. These absolute paths are most often user-specific, however, so once documents are shared with other users, the relationship gets "broken" anyhow.

Applies to