我下载了一个dsoframer 控件,现在我需要通过该控件控件word ,在其中插入图片,
100分相送(我的等级所能给的最高分了)
请各位高手帮忙。

解决方案 »

  1.   

    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.   

    大哥,我是要在dsoframer 控件里面操作,楼上大哥说的,忘记了一个前提,就是我要怎样才能获得 这个doc 对象。
    谢谢
      

  3.   

    你新建一个Word.ApplicationClass app = new Word.ApplicationClass();
    在建一个对象就可以了
      

  4.   

    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;
      

  5.   

    这个我知道,但是在dsoframer 中,没办法实现,再问一个问题,要怎样才能实现插入的图片浮在文字上面,用代码控制。
      

  6.   

    请各位用过 dsoframer.ocx 老大帮忙了,分不够的话,可以再开新贴给分。
      

  7.   

    用宏查VBA吧
    看图片 浮在文字上面
    的代码
    dsoframer.ocx 没有用过自己做一个控件算了
    别人做的控件很少有人用过的
    因为用起来不方便又没有详细的说明
      

  8.   

    这到也是,我也是没办法,自己做一个控件没时间,在说这个控件基本上满足了我的条件,
    就差这一个插入图片了,
    在CSDN 好像有人实现过,但是没代码,郁闷...
    图片 浮在文字上面试过了,录不了宏。
      

  9.   


        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)
    这是我录制的宏
    楼主看看吧
      

  10.   

    谢谢楼上的兄台
    总算解决一个问题。不知dsoframer.ocx 插入图片的问题可有哪个高手知道。
      

  11.   

    自己解决了,感谢 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
      

  12.   

    再问一个问题,怎样用代码控件多个图片,
    第一图片是  ActiveDocument.Shapes("Picture 2").Select第二图片呢,
    希望有高手能帮忙解答
      

  13.   

    怎么知道selection所在table的tableindex?