以编程方式嵌入图片到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();
                 }
             }
        }


发布了24 篇原创文章 · 获赞 3 · 访问量 6万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览