How to know that the text font is unicode in a word document? RRS feed

  • Question

  • I am developing a word application level addin. How to determine that the text font is unicode or not? I want to know this as I am developing a font converter for my native language and changing non-unicode text to unicode text. 

    An early reply will be highly appreciated.


    Dharam Veer Sharma

    Saturday, February 7, 2015 11:15 AM


All replies

  • Hello,

    You can use the TextEncoding property of the Document class. It returns the code page, or character set, that Microsoft Word uses for a document saved as an encoded text file. 

    Sunday, February 8, 2015 12:04 PM
  • Thanks Eugene for replying.

    TextEncoding works for document level, but with in the document some text may be in English and some other may be in other non-unicode font. In such a, case how to determine whether the text (may be just some part of it) is in unicode or not?

    Dharam Veer Sharma

    Sunday, February 8, 2015 12:19 PM
  • Dharam,

    The Word object model doesn't provide any property or method for that. But you may try to use the following Range properties:

    LanguageID - a WdLanguageID constant that represents the language for the specified range. 

    LanguageIDFarEast - an East Asian language for the specified object.

    LanguageIDOther  - the language for the specified range.

    LanguageDetected - a value that specifies whether Microsoft Word has detected the language of the specified text.

    Sunday, February 8, 2015 8:22 PM