DocumentBase.OpenEncoding 属性

定义

获取用于打开文档的编码。

public Microsoft.Office.Core.MsoEncoding OpenEncoding { get; }

属性值

MsoEncoding

MsoEncoding 值之一。

示例

下面的代码示例将检查该文档是否为 UTF7 编码的文档,并显示一条显示结果的消息。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void DocumentOpenEncoding()
{
    if (this.OpenEncoding == Microsoft.Office.Core.MsoEncoding.msoEncodingUTF7)
    {
        MessageBox.Show("This is a UTF7-encoded text file!");
    }
    else
    {
        MessageBox.Show("This is not a UTF7-encoded text file!");
    }
}
Private Sub DocumentOpenEncoding()
    If Me.OpenEncoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF7 Then
        MessageBox.Show("This is a UTF7-encoded text file!")
    Else
        MessageBox.Show("This is not a UTF7-encoded text file!")
    End If
End Sub 

适用于