DocumentBase.OpenEncoding Property

 

Gets the encoding used to open the document.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public MsoEncoding OpenEncoding { get; }

Property Value

Type: Microsoft.Office.Core.MsoEncoding

One of the MsoEncoding values.

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!");
    }
}
Return to top
Show: