dsoframer控制word,插入图片

tangsailei 2006-03-24 09:43:52
我下载了一个dsoframer 控件,现在我需要通过该控件控件word ,在其中插入图片,
100分相送(我的等级所能给的最高分了)
请各位高手帮忙。
...全文
561 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
mtssdlh 2006-04-04
  • 打赏
  • 举报
回复
怎么知道selection所在table的tableindex?
tangsailei 2006-03-27
  • 打赏
  • 举报
回复
自己解决了,感谢 20011521
现贴出来给各位有需要的朋友


Sub AfterAddPicture(Url)
dim m

On Error Resume Next
oframe.ActiveDocument.ActiveWindow.Selection.InlineShapes.AddPicture Url,false,true

m = oframe.ActiveDocument.InlineShapes.Count
m = m + oframe.ActiveDocument.Shapes.Count


oframe.ActiveDocument.InlineShapes(m).ConvertToShape

End Sub
tangsailei 2006-03-27
  • 打赏
  • 举报
回复
再问一个问题,怎样用代码控件多个图片,
第一图片是 ActiveDocument.Shapes("Picture 2").Select

第二图片呢,
。。。

希望有高手能帮忙解答
tangsailei 2006-03-24
  • 打赏
  • 举报
回复
谢谢楼上的兄台
总算解决一个问题。

不知dsoframer.ocx 插入图片的问题可有哪个高手知道。
20011521 2006-03-24
  • 打赏
  • 举报
回复
祝楼主好运
20011521 2006-03-24
  • 打赏
  • 举报
回复

ActiveDocument.Shapes("Picture 2").Select
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.PictureFormat.Brightness = 0.5
Selection.ShapeRange.PictureFormat.Contrast = 0.5
Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic
Selection.ShapeRange.PictureFormat.CropLeft = 0#
Selection.ShapeRange.PictureFormat.CropRight = 0#
Selection.ShapeRange.PictureFormat.CropTop = 0#
Selection.ShapeRange.PictureFormat.CropBottom = 0#
Selection.ShapeRange.Left = 90.4
Selection.ShapeRange.Top = 329.65
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionColumn
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionParagraph
Selection.ShapeRange.Left = CentimetersToPoints(0.01)
Selection.ShapeRange.Top = CentimetersToPoints(0.28)
Selection.ShapeRange.LockAnchor = False
Selection.ShapeRange.LayoutInCell = True
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
这是我录制的宏
楼主看看吧
tangsailei 2006-03-24
  • 打赏
  • 举报
回复
这到也是,我也是没办法,自己做一个控件没时间,在说这个控件基本上满足了我的条件,
就差这一个插入图片了,
在CSDN 好像有人实现过,但是没代码,郁闷...


图片 浮在文字上面试过了,录不了宏。
20011521 2006-03-24
  • 打赏
  • 举报
回复
用宏查VBA吧
看图片 浮在文字上面
的代码
dsoframer.ocx 没有用过自己做一个控件算了
别人做的控件很少有人用过的
因为用起来不方便又没有详细的说明
tangsailei 2006-03-24
  • 打赏
  • 举报
回复
请各位用过 dsoframer.ocx 老大帮忙了,分不够的话,可以再开新贴给分。
tangsailei 2006-03-24
  • 打赏
  • 举报
回复
这个我知道,但是在dsoframer 中,没办法实现,

再问一个问题,要怎样才能实现插入的图片浮在文字上面,用代码控制。
20011521 2006-03-24
  • 打赏
  • 举报
回复
Word.ApplicationClass wd=new Word.ApplicationClass();
object oMissing = System.Reflection.Missing.Value;
wd.Documents.Add(ref oMissing,ref oMissing,ref oMissing,ref oMissing);

Word.Document doc=wd.ActiveDocument;
20011521 2006-03-24
  • 打赏
  • 举报
回复
你新建一个Word.ApplicationClass app = new Word.ApplicationClass();
在建一个对象就可以了
tangsailei 2006-03-24
  • 打赏
  • 举报
回复
大哥,我是要在dsoframer 控件里面操作,楼上大哥说的,忘记了一个前提,就是我要怎样才能获得 这个doc 对象。
谢谢
20011521 2006-03-24
  • 打赏
  • 举报
回复
还有一种方法就是
先把图片弄到剪帖板上在粘帖上去
好了给分吧
20011521 2006-03-24
  • 打赏
  • 举报
回复
string fileName = "c://msdn.bmp"; //要插入的图片
Object oMissed = doc.Paragraphs[2].Range; //插入的位置,替换第二段内容
Object oLinkToFile = false; //缺省
Object oSaveWithDocument = true;//缺省
doc.InlineShapes.AddPicture(fieldName, ref oLinkToFile, ref oSaveWithDocument, ref oMissed); //doc为活动文档的名称,即正在操作的文档

Selection.Font.Bold = true
M

2,462

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧