Shape 对象代表文档中的图形对象,InlineShape 代表文档中的嵌入式图形对象。 所谓嵌入式图形对象,是指将图像作为文字处理,在排版上以文字的方式进行排版。 Shape 与 InlineShape 对象在文档中分别属于 Shapes 集合与 InlineShapes 集合。 通过 Shape 对象的 ConvertToInlineShape 方法可以将 Shape 对象转换为 InlineShape 对象。 通过 InlineShape 对象的 ConvertToShape 方法可将 InlineShape 对象转换为 Shape 对象。 Shapes 集合与 InlineShapes 集合都有 AddPicture 方法,用于在文档中插入图片。两方法的定义如下: Shapes: Function AddPicture(FileName As String, [LinkToFile], [SaveWithDocument], [Left], [Top], [Width], [Height], [Anchor]) As Shape InlineShapes: Function AddPicture(FileName As String, [LinkToFile], [SaveWithDocument], [Range]) As InlineShape 两个方法的不同在于插入的位置的不同: InlineShapes 只能指定 Range 进行插入。这与文档中的文字插入是相同的。 Shapes 插入的图片可以任意定位。 |
|