Udostępnij za pośrednictwem


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)

Syntax

'Declaration
Public Sub TransformDocument ( _
    path As String, _
    dataOnly As Boolean _
)
public void TransformDocument(
    string path,
    bool dataOnly
)

Parameters

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

Remarks

Optional Parameters

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

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 Sub DocumentTransformDocument()
    Me.TransformDocument("C:\CustomTransform.xslt", True)
End Sub 
private void DocumentTransformDocument()
{
    this.TransformDocument(@"C:\CustomTransform.xslt", true);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace