How to convert zh-chs to zh-cht?

1、Add reference. 
      Create a new winform project, import Microsoft Word 9.0 Object Library to the project, because the version of the ms office I installed is 2000.

2、Design the Form1. 
      textBox1: Input the zh-chs content.
      textBox2: Output the zh-cht content.

3、Write main code.
    Word.DocumentClass doc = new Word.DocumentClass();
     doc.Content.Text = this.textBox1.Text;
     try
     {
          doc.Content.TCSCConverter(
                    Word.WdTCSCConverterDirection.wdTCSCConverterDirectionSCTC,
                    true,
                    true
           );
           this.textBox2.Text = doc.Content.Text;
     }
     catch(Exception ex)
    {
           MessageBox.Show(ex.Message);
    }
    finally
    {
           object obj1 = (object)Word.WdSaveOptions.wdDoNotSaveChanges;
           object obj2 = null;
           object obj3 = null;

          doc.Close(ref obj1, ref obj2, ref obj3);
     }

posted on 2004-03-11 00:49  Snowwolf  阅读(664)  评论(0编辑  收藏  举报

导航