none
API for converting Chinese Traditional to Chinese Simplified RRS feed

  • Question

  • MS Word 2013 has the capability to convert Chinese Traditional characters to Chinese Simplified.  Is there an API to access that functionality?
    Wednesday, February 10, 2016 3:59 PM

Answers

  • >>>how can I use that to convert a string or document from Traditional Chinese to Simplified Chinese?  What is the call in C# to do so?

    According to your description, if you want to convert Chinese Traditional characters to Chinese Simplified with C#, you could use Strings.StrConv Method (String, VbStrConv, Int32). You could refer to codes below:

    using Microsoft.VisualBasic;
    using Word=Microsoft.Office.Interop.Word;
    using System.Runtime.InteropServices;
    
    namespace ConStrConv
    {
        class Program
        {
            static void Main(string[] args)
            {
                Word.Application application = null;
                try
                {
                    application = new Word.Application();
                    var document = application.Documents.Open("D:\\simpleChinese.docx");
                    string traditional = document.Paragraphs[1].Range.Text;
                    string simple = Strings.StrConv(traditional, VbStrConv.SimplifiedChinese, 2052);
                    document.Paragraphs[1].Range.Text = simple;
                    document.Save();
                    ((Word._Document)document).Close();
                }
                finally
                {
                    if (application != null)
                    {
                        ((Word._Application)application).Quit();
                        Marshal.FinalReleaseComObject(application);
                    }
                }
                Console.ReadLine();
            }
        }
    }
    

    Before converting:

    then get this result:

    For more information, click here to refer about Strings.StrConv Method (String, VbStrConv, Int32)

    • Marked as answer by David_JunFeng Saturday, March 5, 2016 3:23 PM
    Wednesday, February 24, 2016 8:41 AM

All replies

  • >>>MS Word 2013 has the capability to convert Chinese Traditional characters to Chinese Simplified.  Is there an API to access that functionality?

    According to your description, as far as I know  you can download the Chinese Proofing Tools and Translation ScreenTips for free, and purchase single-language Office Language Packs downloads (in 简体 or 繁體 versions, with Chinese-language installers only) for USD $24.99 direct from Microsoft.

    If you have an Office 365 subscription, you don't even need to buy Language Packs: you can then just install Office entirely in Chinese, including TC/SC conversion and the other tools! But you may

    want to buy a Language Pack for use with an English-language installation.

    Office 2013 "Language Preferences" (in your Start menu with Office) contains links to the Microsoft download page, but here it is direct: Office 2013 Language Packs, Proofing Tools and ScreenTips

    For each language for which proofing tools are installed, you can use the ActiveGrammarDictionary, ActiveHyphenationDictionary, ActiveSpellingDictionary, and ActiveThesaurusDictionary properties to return the corresponding Dictionary object.

    For more information, click here to refer about Language Object (Word)

    • Marked as answer by David_JunFeng Thursday, February 18, 2016 2:31 PM
    • Unmarked as answer by Cucamonga Thursday, February 18, 2016 2:59 PM
    Thursday, February 11, 2016 7:51 AM
  • Once I have a Dictionary object, how can I use that to convert a string or document from Traditional Chinese to Simplified Chinese?  What is the call in C# to do so?
    Thursday, February 18, 2016 3:02 PM
  • >>>how can I use that to convert a string or document from Traditional Chinese to Simplified Chinese?  What is the call in C# to do so?

    According to your description, if you want to convert Chinese Traditional characters to Chinese Simplified with C#, you could use Strings.StrConv Method (String, VbStrConv, Int32). You could refer to codes below:

    using Microsoft.VisualBasic;
    using Word=Microsoft.Office.Interop.Word;
    using System.Runtime.InteropServices;
    
    namespace ConStrConv
    {
        class Program
        {
            static void Main(string[] args)
            {
                Word.Application application = null;
                try
                {
                    application = new Word.Application();
                    var document = application.Documents.Open("D:\\simpleChinese.docx");
                    string traditional = document.Paragraphs[1].Range.Text;
                    string simple = Strings.StrConv(traditional, VbStrConv.SimplifiedChinese, 2052);
                    document.Paragraphs[1].Range.Text = simple;
                    document.Save();
                    ((Word._Document)document).Close();
                }
                finally
                {
                    if (application != null)
                    {
                        ((Word._Application)application).Quit();
                        Marshal.FinalReleaseComObject(application);
                    }
                }
                Console.ReadLine();
            }
        }
    }
    

    Before converting:

    then get this result:

    For more information, click here to refer about Strings.StrConv Method (String, VbStrConv, Int32)

    • Marked as answer by David_JunFeng Saturday, March 5, 2016 3:23 PM
    Wednesday, February 24, 2016 8:41 AM