DocumentBase.TextEncoding Property

Definition

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

public:
 property Microsoft::Office::Core::MsoEncoding TextEncoding { Microsoft::Office::Core::MsoEncoding get(); void set(Microsoft::Office::Core::MsoEncoding value); };
public Microsoft.Office.Core.MsoEncoding TextEncoding { get; set; }
member this.TextEncoding : Microsoft.Office.Core.MsoEncoding with get, set
Public Property TextEncoding As MsoEncoding

Property Value

One of the MsoEncoding values.

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 void DocumentTextEncoding()
{
    this.TextEncoding = Office.MsoEncoding.msoEncodingWestern;
}
Private Sub DocumentTextEncoding()
    Me.TextEncoding = Office.MsoEncoding.msoEncodingWestern
End Sub 

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.

Applies to