vsto 判断word选中的是否是图片


                    Word.Selection Sel = app.Selection;

                   
                    if (Sel.InlineShapes.Count == 1)
                    {
                        if (Sel.InlineShapes[1].Type == Word.WdInlineShapeType.wdInlineShapePicture)
                        { 
                                    MessageBox.Show("光标选中的是嵌入式图片!");
                        }
                    }

                    if (Sel.ShapeRange.Count == 1)
                    {
                        if (Sel.ShapeRange[1].Type == MsoShapeType.msoPicture)
                        { 
                        MessageBox.Show("光标选中的是非嵌入式图片!");
                        }
                    }

你可能感兴趣的:(C#,VSTO,word)