DocumentBase.TextEncoding Property

Gets or sets the code page, or character set, that Microsoft Office Word uses for a document saved as an encoded text file.

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 Property TextEncoding As MsoEncoding
public MsoEncoding TextEncoding { get; set; }

Property Value

Type: MsoEncoding
One of the MsoEncoding values.

Remarks

This property sets text encoding separately from HTML encoding, which you can set using the Encoding property of the WebOptions object. You can get the WebOptions object from the WebOptions property. To set text encoding for all documents saved as text files, use the DefaultTextEncoding property.

Examples

The following code example sets the document encoding to Western if the document is saved as a text file. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentTextEncoding()
    Me.TextEncoding = Office.MsoEncoding.msoEncodingWestern
End Sub
private void DocumentTextEncoding()
{
    this.TextEncoding = Office.MsoEncoding.msoEncodingWestern;
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace