private void AddPictureControlAtRange() { this.Paragraphs[1].Range.InsertParagraphBefore(); pictureControl2 = this.Controls.AddPictureContentControl( this.Paragraphs[1].Range, "pictureControl2"); string imagePath = System.Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "\\picture.bmp"; bitmap2 = new System.Drawing.Bitmap(imagePath, true); pictureControl2.Image = bitmap2; }
private void CreatePictureControlFromNativeControl() { if (this.ContentControls.Count <= 0) { return; } pictureControls = new System.Collections.Generic.List <Microsoft.Office.Tools.Word.PictureContentControl>(); int count = 0; foreach (Word.ContentControl nativeControl in this.ContentControls) { if (nativeControl.Type == Word.WdContentControlType.wdContentControlPicture) { count++; Microsoft.Office.Tools.Word.PictureContentControl tempControl = this.Controls.AddPictureContentControl(nativeControl, "VSTOPictureContentControl" + count.ToString()); pictureControls.Add(tempControl); } } }