private void mnuFile_OpenFile_Click(object sender, RoutedEventArgs e)
        {
            TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
            ls.ApplicationFieldFormat    = TXTextControl.ApplicationFieldFormat.MSWord;
            ls.ApplicationFieldTypeNames = new string[] { "表单文本" };

            textControl1.Load(TXTextControl.StreamType.MSWord | TXTextControl.StreamType.WordprocessingML, ls);
        }
        private void textControl1_Loaded(object sender, RoutedEventArgs e)
        {
            textControl1.Focus();

            //dsAddresses = new DataSet();
            //dsAddresses.ReadXml("data2.xml");

            mailMerge1 = new MailMerge();
            mailMerge1.TextComponent = textControl1;

            TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
            ls.ApplicationFieldFormat = TXTextControl.ApplicationFieldFormat.MSWord;
            ls.LoadSubTextParts       = true;

            //textControl1.Load("333.docx", StreamType.WordprocessingML, ls);

            CommClient.MedicalRecord    medicalRecordClient = new CommClient.MedicalRecord();
            CommContracts.MedicalRecord medicalRecord       = medicalRecordClient.GetMedicalRecord(7);

            textControl1.Load(medicalRecord.ContentXml, TXTextControl.StringStreamType.RichTextFormat);
        }
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings();
            ls.ApplicationFieldFormat = TXTextControl.ApplicationFieldFormat.MSWord;

            // load a sample document with all supported types of
            // content controls
            textControl1.Load("test.docx", TXTextControl.StreamType.WordprocessingML, ls);

            // loop through all fields
            foreach (ApplicationField field in textControl1.ApplicationFields)
            {
                Type type = ContentControlFieldAdapter.GetContentControlType(field);

                // based on the type, create a new ContentControl object and
                // display some field information in a MessageBox
                switch (type.Name)
                {
                    case "RichTextContentControl":
                        RichTextContentControl rtb = new RichTextContentControl(field);

                        MessageBox.Show("RichTextContentControl:\r\nText: " + rtb.Text + "\r\n" +
                            "Title: " + rtb.Title + "\r\n" +
                            "Tag: " + rtb.Tag + "\r\n");
                        break;

                    case "PlainTextContentControl":
                        PlainTextContentControl ptc = new PlainTextContentControl(field);

                        MessageBox.Show("PlainTextContentControl:\r\nText: " + ptc.Text + "\r\n" +
                            "Title: " + ptc.Title + "\r\n" +
                            "Tag: " + ptc.Tag + "\r\n");
                        break;

                    case "CheckBoxContentControl":
                        CheckBoxContentControl check = new CheckBoxContentControl(field);

                        MessageBox.Show("CheckBoxContentControl:\r\nChecked: " + check.Checked.ToString() + "\r\n" +
                            "Title: " + check.Title + "\r\n" +
                            "Tag: " + check.Tag + "\r\n");
                        break;

                    case "ComboBoxContentControl":
                        ComboBoxContentControl combo = new ComboBoxContentControl(field);
                        
                        string items = "";

                        foreach (ComboBoxListItem item in combo.ListItems)
                        {
                            items += "Item: " + item.DisplayText + "\r\n";
                        }

                        MessageBox.Show("ComboBoxContentControl:\r\n" +
                            "Title: " + combo.Title + "\r\n" +
                            "Tag: " + combo.Tag + "\r\n" +
                            items);
                        break;

                    case "DateContentControl":
                        DateContentControl date = new DateContentControl(field);

                        MessageBox.Show("DateContentControl:\r\n" +
                            "Title: " + date.Title + "\r\n" +
                            "Tag: " + date.Tag + "\r\n" +
                            "Date: " + date.Date + "\r\n" +
                            "Calendar: " + date.Calendar + "\r\n" +
                            "Format: " + date.DateFormat + "\r\n");
                            
                        break;

                    case "DropDownListContentControl":
                        DropDownListContentControl drop = new DropDownListContentControl(field);

                        string dropItems = "";

                        foreach (DropDownListItem item in drop.ListItems)
                        {
                            dropItems += "Item: " + item.DisplayText + ", " + item.Value + "\r\n";
                        }

                        MessageBox.Show("DropDownListContentControl:\r\n" +
                            "Title: " + drop.Title + "\r\n" +
                            "Tag: " + drop.Tag + "\r\n" +
                            dropItems);
                        break;
                }
            }
        }