DocumentBase.TextEncoding 属性

定义

获取或设置 Microsoft Office Word 在另存为编码文本文件的文档中使用的代码页或字符集。

public Microsoft.Office.Core.MsoEncoding TextEncoding { get; set; }

属性值

MsoEncoding

MsoEncoding 值之一。

示例

如果文档另存为文本文件,则下面的代码示例将文档编码设置为西方。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

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

注解

此属性与 HTML 编码分开设置文本编码,可以使用对象的属性进行设置 Encoding WebOptions 。 可以 WebOptions 从属性获取对象 WebOptions 。 若要为保存为文本文件的所有文档设置文本编码,请使用 DefaultTextEncoding 属性。

适用于