Export (0) Print
Expand All
Expand Minimize

DocumentBase.TransformDocument Method

Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the document and replaces the document with the results.

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

public void TransformDocument(
	string path,
	bool dataOnly
)

Parameters

path
Type: System.String

The path of the XSLT file.

dataOnly
Type: System.Boolean

true applies the transformation only to the data in the document, excluding Microsoft Office Word XML. false applies the transform to the entire document, including Word XML. Default value is true.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example transforms only the data in the document using the specified XSLT file. This example assumes that the CustomTransform.xslt file exists at the root of the C directory. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentTransformDocument()
{
    this.TransformDocument(@"C:\CustomTransform.xslt", true);
}

Show:
© 2014 Microsoft