Share via


DocumentBase.OpenEncoding Property

Definition

Gets the encoding used to open the document.

public:
 property Microsoft::Office::Core::MsoEncoding OpenEncoding { Microsoft::Office::Core::MsoEncoding get(); };
public Microsoft.Office.Core.MsoEncoding OpenEncoding { get; }
member this.OpenEncoding : Microsoft.Office.Core.MsoEncoding
Public ReadOnly Property OpenEncoding As MsoEncoding

Property Value

One of the MsoEncoding values.

Examples

The following code example checks whether the document is a UTF7-encoded document and displays a message that shows the results. To use this example, run it from the ThisDocument class in a document-level project.

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 

Applies to