OLE方式 word中插入图片

我是在delphi中用olecontainer操作word,要向其中插入图片,使用粘贴板。但是图片放入后位置是这一行的开始位置,如下:  
      {   将一副图片粘贴到word中   }  
      ClipBoard.Assign(aImage.Picture);  
      {   以下为vba代码--可在word中利用录制宏的功能取得--------------------bagin   }  
      {           使用vba之前加   x.OleObject.application   例如:excel添加工作表   }  
      {                   oc.OleObject.application.sheets.Add;       }  
      intInlineShapesIndex:=ocDoc.OleObject.application.ThisDocument.InlineShapes.Count+1;  
      intShapesIndex:=ocDoc.OleObject.application.ThisDocument.Shapes.Count+1;  
      //从剪贴板添加一个图片  
      ocDoc.OleObject.application.Selection.Paste;  
      //转换为图形  
      ocDoc.OleObject.application.ThisDocument.InlineShapes(intInlineShapesIndex).ConvertToShape;  
      //设置文字环绕方式  
      ocDoc.OleObject.application.ThisDocument.Shapes(intShapesIndex).WrapFormat.Type   :=   'wdWrapThrough';  
      //将图片中的白色设为透明色  
      ocDoc.OleObject.application.Selection.InlineShapes(intShapesIndex).PictureFormat.TransparentBackground   :=   'msoTrue';  
      ocDoc.OleObject.application.Selection.InlineShapes(intShapesIndex).PictureFormat.TransparencyColor:='RGB(255,255,255)';  
      ocDoc.OleObject.application.Selection.InlineShapes(intShapesIndex).Fill.Visible   :=   'msoFalse';  
      {   以上为vba代码--可在word中利用录制宏的功能取得----------------------end   } Top
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值