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)
Syntax
'Declaration
Public ReadOnly Property OpenEncoding As MsoEncoding
public MsoEncoding OpenEncoding { get; }
Property Value
Type: Microsoft.Office.Core.MsoEncoding
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 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
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!");
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.