CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Posts
    5

    Picture export to word in rtf format

    Problem:
    I got a jpeg picture saved and I export it to a word document (under rtf format )in a table using:
    "{\field{\*\fldinst { INCLUDEPICTURE " & pictname.jpg & " \\* MERGEFORMAT \\d }}}"
    The picture is then linked to the document...
    the thing is than the picture appears in the document but is too big...
    Does anyone knows what i should write to reduce the size of the picture before exporting it ???
    Thanks



  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Picture export to word in rtf format

    Check this out. It might help you

    'Objective - put several images into picture box and resize each image

    Place several image boxes in a picturebox control. Set the Stretch property of each imagebox to true and
    load your pictures in these image boxes.
    Now, when you change the height and width properties of the imageboxes, the pictures will resize.
    Changing the size with the mouse (and you would want resizing handles too), it is a bit more complicated...
    Load your images in the two image boxes within the picture box.
    There is a picture box. Within it are two image boxes with the images and eight labels for the handles.
    You will have to work upon it to make it better.


    private Sub PositionHandles(X1 as Integer, Y1 as Integer, X2 as Integer, Y2 as Integer, lblwid as Integer, lblhgt as Integer)
    Dim i as Integer

    lblHandle(0).Left = X1 - lblwid
    lblHandle(0).Top = Y1 - lblhgt
    lblHandle(1).Left = (X1 + X2 - lblwid) / 2
    lblHandle(1).Top = Y1 - lblhgt
    lblHandle(2).Left = X2
    lblHandle(2).Top = Y1 - lblhgt

    lblHandle(3).Left = X1 - lblwid
    lblHandle(3).Top = (Y1 + Y2 - lblhgt) / 2
    lblHandle(4).Left = X2
    lblHandle(4).Top = (Y1 + Y2 - lblhgt) / 2

    lblHandle(5).Left = X1 - lblwid
    lblHandle(5).Top = Y2
    lblHandle(6).Left = (X1 + X2 - lblwid) / 2
    lblHandle(6).Top = Y2
    lblHandle(7).Left = X2
    lblHandle(7).Top = Y2
    End Sub

    private Sub Form_Load()
    SelIndx = 0
    Call PositionHandles(imgPic(SelIndx).Left, imgPic(SelIndx).Top, imgPic(SelIndx).Left + imgPic(SelIndx).Width, imgPic(SelIndx).Top + imgPic(SelIndx).Height, 90, 90)
    End Sub

    private Sub imgPic_Click(Index as Integer)
    Call PositionHandles(imgPic(Index).Left, imgPic(Index).Top, imgPic(Index).Left + imgPic(Index).Width, imgPic(Index).Top + imgPic(Index).Height, 90, 90)
    SelIndx = Index
    imgPic(SelIndx).ZOrder
    End Sub

    private Sub lblHandle_MouseDown(Index as Integer, Button as Integer, Shift as Integer, X as Single, Y as Single)
    lblHandle(Index).Tag = X & " " & Y
    End Sub

    private Sub lblHandle_MouseUp(Index as Integer, Button as Integer, Shift as Integer, X as Single, Y as Single)
    Dim DiffX as Integer, DiffY as Integer
    DiffX = X - Val(Left$(lblHandle(Index).Tag, 5))
    DiffY = Y - Val(Right$(lblHandle(Index).Tag, 5))
    Select Case Index
    Case 0:
    With imgPic(SelIndx)
    .Move .Left - DiffX, .Top - DiffY, .Width + DiffX, .Height + DiffY
    End With
    Case 1:
    With imgPic(SelIndx)
    .Move .Left, .Top - DiffY, .Width, .Height + DiffY
    End With
    Case 2:
    With imgPic(SelIndx)
    .Move .Left, .Top - DiffY, .Width + DiffX, .Height + DiffY
    End With
    Case 3:
    With imgPic(SelIndx)
    .Move .Left - DiffX, .Top, .Width + DiffX, .Height
    End With
    Case 4:
    With imgPic(SelIndx)
    .Move .Left, .Top, .Width + DiffX, .Height
    End With
    Case 5:
    With imgPic(SelIndx)
    .Move .Left - DiffX, .Top, .Width, .Height + DiffY
    End With
    Case 6:
    With imgPic(SelIndx)
    .Move .Left, .Top, .Width, .Height + DiffY
    End With
    Case 7:
    With imgPic(SelIndx)
    .Move .Left, .Top, .Width + DiffX, .Height + DiffY
    End With
    End Select
    Call PositionHandles(imgPic(SelIndx).Left, imgPic(SelIndx).Top, imgPic(SelIndx).Left + imgPic(SelIndx).Width, imgPic(SelIndx).Top + imgPic(SelIndx).Height, 90, 90)
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured