我使用程序往word 中添加了图片
//查找书签
                            doc.Books.get_Item(ref bookMark).Select();
                            //在书签的位置添加图片
                            Microsoft.Office.Interop.Word.InlineShape inlineShape = wordApp.Selection.InlineShapes.AddPicture(replacePic, ref linkToFile, ref saveWithDocument, ref Nothing);
                            //设置图片大小
                            inlineShape.Width = int.Parse(imageTDO.GetProperty("ImageWidth").ToString());
                            inlineShape.Height = int.Parse(imageTDO.GetProperty("ImageHeight").ToString());
                            Microsoft.Office.Interop.Word.Shape shap = inlineShape.ConvertToShape();
                            //设置水平绝对位置参照
                            shap.RelativeHorizontalPosition = Microsoft.Office.Interop.Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionColumn;
                            //设置垂直绝对位置参照
                            shap.RelativeVerticalPosition = Microsoft.Office.Interop.Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionLine;
                            shap.Top = int.Parse(imageTDO.GetProperty("ImageTop").ToString()); ; //向上补齐 -90 
                            shap.Left = int.Parse(imageTDO.GetProperty("ImageLeft").ToString());
添加的关键代码如上。(大家也可以拿去用,试过很多遍好使)
效果 
我现在想把这个图片用程序删除掉,应该怎么删呢,请大神们帮帮忙。

解决方案 »

  1.   

      Microsoft.Office.Interop.Word.InlineShape inlineShape = wordApp.Selection.InlineShapes.AddPicture(replacePic, ref linkToFile, ref saveWithDocument, ref Nothing);
                                //设置图片大小
                                inlineShape.Width = int.Parse(imageTDO.GetProperty("ImageWidth").ToString());
                                inlineShape.Height = int.Parse(imageTDO.GetProperty("ImageHeight").ToString());
                                Microsoft.Office.Interop.Word.Shape shap = inlineShape.ConvertToShape();
                                //设置水平绝对位置参照
                                shap.RelativeHorizontalPosition = Microsoft.Office.Interop.Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionColumn;
                                //设置垂直绝对位置参照
                                shap.RelativeVerticalPosition = Microsoft.Office.Interop.Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionLine;
                                shap.Top = int.Parse(imageTDO.GetProperty("ImageTop").ToString()); ; //向上补齐 -90 
                                shap.Left = int.Parse(imageTDO.GetProperty("ImageLeft").ToString());