共用方式為


DocumentBase.TransformDocument(String, Boolean) Method

Definition

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

public void TransformDocument (string path, bool dataOnly);
member this.TransformDocument : string * bool -> unit
Public Sub TransformDocument (path As String, Optional dataOnly As Boolean)

Parameters

path
String

The path of the XSLT file.

dataOnly
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.

Examples

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);
}
Private Sub DocumentTransformDocument()
    Me.TransformDocument("C:\CustomTransform.xslt", True)
End Sub 

Remarks

Optional Parameters

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

Applies to