dsoframer控制word,插入图片 我下载了一个dsoframer 控件,现在我需要通过该控件控件word ,在其中插入图片,100分相送(我的等级所能给的最高分了)请各位高手帮忙。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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 = trueM 大哥,我是要在dsoframer 控件里面操作,楼上大哥说的,忘记了一个前提,就是我要怎样才能获得 这个doc 对象。谢谢 你新建一个Word.ApplicationClass app = new Word.ApplicationClass();在建一个对象就可以了 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; 这个我知道,但是在dsoframer 中,没办法实现,再问一个问题,要怎样才能实现插入的图片浮在文字上面,用代码控制。 请各位用过 dsoframer.ocx 老大帮忙了,分不够的话,可以再开新贴给分。 用宏查VBA吧看图片 浮在文字上面的代码dsoframer.ocx 没有用过自己做一个控件算了别人做的控件很少有人用过的因为用起来不方便又没有详细的说明 这到也是,我也是没办法,自己做一个控件没时间,在说这个控件基本上满足了我的条件,就差这一个插入图片了,在CSDN 好像有人实现过,但是没代码,郁闷...图片 浮在文字上面试过了,录不了宏。 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)这是我录制的宏楼主看看吧 谢谢楼上的兄台总算解决一个问题。不知dsoframer.ocx 插入图片的问题可有哪个高手知道。 自己解决了,感谢 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 再问一个问题,怎样用代码控件多个图片,第一图片是 ActiveDocument.Shapes("Picture 2").Select第二图片呢,希望有高手能帮忙解答 怎么知道selection所在table的tableindex? 利用VB采集部分网页数据 假设i代表"3123123"又代表"0891231",怎样的代码???急求!! 我是新手,问一个文本操作方面的简单问题 几个问题,高手请进 19号icedut过生日,帮她散分 如何过滤用户输入的字符串 请教各位大侠:关于怎样用VB实现从某一个网站上下载升级包?。。。急急 在线等。 结束进程 什么是web应用程序?它普通应用程序有什么不同? 三维图像分水岭分析 请问Winsock控件UDP协议怎么使用数组啊 用winsock使用TCP/IP协议时如何传送8k以上的文件
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
谢谢
在建一个对象就可以了
object oMissing = System.Reflection.Missing.Value;
wd.Documents.Add(ref oMissing,ref oMissing,ref oMissing,ref oMissing); Word.Document doc=wd.ActiveDocument;
看图片 浮在文字上面
的代码
dsoframer.ocx 没有用过自己做一个控件算了
别人做的控件很少有人用过的
因为用起来不方便又没有详细的说明
就差这一个插入图片了,
在CSDN 好像有人实现过,但是没代码,郁闷...
图片 浮在文字上面试过了,录不了宏。
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)
这是我录制的宏
楼主看看吧
总算解决一个问题。不知dsoframer.ocx 插入图片的问题可有哪个高手知道。
现贴出来给各位有需要的朋友
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
第一图片是 ActiveDocument.Shapes("Picture 2").Select第二图片呢,
希望有高手能帮忙解答