Z
zmoliver
Unregistered / Unconfirmed
GUEST, unregistred user!
我在word里的宏命令完成在文档里插入图片,并修改图片的大小。宏指令如下所示:
Sub Macro1()
Selection.InlineShapes.AddPicture FileName:="D:/photo/DSC03298.JPG", _
LinkToFile:=False, SaveWithDocument:=True
Selection.TypeBackspace
Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 283.2
Selection.InlineShapes(1).Width = 377.85
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub
转化到delphi中后,的部分语句为:
wordhandle.selection.inlineshapes.addpicture(filename:=edit1.Text);//此句插入图片
wordhandle.selection.typebackspace;//此句是为了将插入的图片选中
wordhandle.selection.inlineshapes(1).height:=283.3;//
wordhandle.selection.inlineshapes(1).width:=377.85;//修改长宽
上面四句中前2句运行没有问题,后面两句不能运行,错误为:inlineshapes不是方法。
不知道这个问题如何解决。
我的主要目的是向word中查入图片,然后修改一下图片的尺寸就可以了,高人有别的方法也希望不吝赐教。谢谢
Sub Macro1()
Selection.InlineShapes.AddPicture FileName:="D:/photo/DSC03298.JPG", _
LinkToFile:=False, SaveWithDocument:=True
Selection.TypeBackspace
Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 283.2
Selection.InlineShapes(1).Width = 377.85
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub
转化到delphi中后,的部分语句为:
wordhandle.selection.inlineshapes.addpicture(filename:=edit1.Text);//此句插入图片
wordhandle.selection.typebackspace;//此句是为了将插入的图片选中
wordhandle.selection.inlineshapes(1).height:=283.3;//
wordhandle.selection.inlineshapes(1).width:=377.85;//修改长宽
上面四句中前2句运行没有问题,后面两句不能运行,错误为:inlineshapes不是方法。
不知道这个问题如何解决。
我的主要目的是向word中查入图片,然后修改一下图片的尺寸就可以了,高人有别的方法也希望不吝赐教。谢谢