以编程方式嵌入图片到Word图片内容控件

C#代码:

        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            // PictureContentControl myPictureContentControl = null;
             foreach (Microsoft.Office.Interop.Word.ContentControl c in Globals.ThisDocument.ContentControls)
             {
                 if (c.Type == WdContentControlType.wdContentControlPicture && c.Tag == "tag1")  // looking for the picture content control i want to update
                 {
                     c.Range.Select();
                     Dialog dialogBox = Globals.ThisDocument.Application.Dialogs[WdWordDialog.wdDialogInsertPicture];
                     dialogBox.Show();
                 }
             }
        }


你可能感兴趣的:(VSTO)