none
Graphics formatting in Word - still RRS feed

  • Question

  • Hi folks (Cindy),

    the graphics formatting thing in Word isnt over yet.

    I do not want to set all those options programatically but I need to find out if the user of my addin did. Therefore I need to know where the Information is stored, set by the shown dialog:

    I found out (as simple as the former thread with the frame of the image) the way to acess the data of the menus "Shadow", "Reflection", "Glow", "SoftEdges". They are all Members of a Interop.Word.Shape-Object. There is a member of the Shape-Object called "ThreeD". But in debugging code, this member object of the shape does not change at all, when I set some 3D things in the dialog. Any hints?

    And there is an image manipulation called "Shape" (see below).

    The Interop.Word.Shape-Object, that represents my image does not have a member called "Shape" or another member, that changes when I do things via the menu nor something that stores an Enum with speaking names referring to the shapes.

    Unluckily Macro recording is switched off for image manipulation. Any hints?

    Cheers MH



    • Edited by MH_dhs Friday, March 16, 2012 9:39 AM
    Friday, March 16, 2012 9:36 AM

Answers

  • Hi MH,

    Thanks for posting in the MSDN forum.

    Do you want to modify the "Bevel"? In the shape instance it will related to BevelBottomDepth, BevelBottomInset, BevelBottomType, BevelTopDepth, BevelTopInset and BevelTopType. In these property the BevelBottomDepth, BevelBottomInsert,BevelTopDepth and BevelTopInsert will be set a single value. And BevelBottom, BevelTopType will be set a value from the enum MsoPresetCamera. I tried to write a VBA snippet to reproduce your goal, it works fine on my side (Word 2010 - V:14.0.6112.5000 32-bit).

    The enum MsoPresentCamera reference: http://msdn.microsoft.com/en-us/library/microsoft.office.core.msobeveltype.aspx

    Sub test()
        Dim doc As Document
        'Dim shp As InlineShape
        'Dim rng As Range
        Dim sp As Shape
        
        Set doc = Application.ActiveDocument
        'Set rng = doc.Range()
        'Set shp = rng.InlineShapes(1)
        'Set sp = shp.ConvertToShape()
        Set sp = doc.Shapes(1)
        
        sp.ThreeD.BevelTopInset = 10
        sp.ThreeD.BevelTopType = msoBevelRelaxedInset
        sp.ThreeD.BevelTopDepth = 6
        
    End Sub

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Monday, March 19, 2012 2:46 AM
    Moderator
  • Hi MH,

    Would you please show more snippet to explain the first question? And do you notice the comment part in my snippet? I think that is the answer for your second question.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, March 21, 2012 7:03 AM
    Moderator

All replies

  • Hi MH,

    Thanks for posting in the MSDN forum.

    Do you want to modify the "Bevel"? In the shape instance it will related to BevelBottomDepth, BevelBottomInset, BevelBottomType, BevelTopDepth, BevelTopInset and BevelTopType. In these property the BevelBottomDepth, BevelBottomInsert,BevelTopDepth and BevelTopInsert will be set a single value. And BevelBottom, BevelTopType will be set a value from the enum MsoPresetCamera. I tried to write a VBA snippet to reproduce your goal, it works fine on my side (Word 2010 - V:14.0.6112.5000 32-bit).

    The enum MsoPresentCamera reference: http://msdn.microsoft.com/en-us/library/microsoft.office.core.msobeveltype.aspx

    Sub test()
        Dim doc As Document
        'Dim shp As InlineShape
        'Dim rng As Range
        Dim sp As Shape
        
        Set doc = Application.ActiveDocument
        'Set rng = doc.Range()
        'Set shp = rng.InlineShapes(1)
        'Set sp = shp.ConvertToShape()
        Set sp = doc.Shapes(1)
        
        sp.ThreeD.BevelTopInset = 10
        sp.ThreeD.BevelTopType = msoBevelRelaxedInset
        sp.ThreeD.BevelTopDepth = 6
        
    End Sub

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Monday, March 19, 2012 2:46 AM
    Moderator
  • Hi Tom,

    the macro works fine, thanks for that. I extened it to demonstrate the effect, that disturbs me:

        Dim sp As Shape
        Set sp = Application.ActiveDocument.Shapes(1)
        sp.ThreeD.BevelTopInset = 10
        sp.Rotation = 27

    I execute the macro while running my AddIn in debug mode and track the concerning Shape instance. Both, the bevel and the rotation are executed (as I observe by having an eye on the document). In contrast my debug screen shows the rotation property but not the bevel.

    You can observe the same effect by putting

    MsgBox sp.ThreeD.BevelTopInset & " " & sp.Rotation

    before and after the shape manipulation in the code. The MsgBox shows 0 both times for the BevelTopInset value although the it has been changed. The change of the Rotation value is shown. Where do I find the bevel information after the change?

    And, secondly, please can you find out how to access that "Shape" property of the image object as described in the second part of my first post?

    Cheers,
    MH

    • Edited by MH_dhs Tuesday, March 20, 2012 10:22 AM
    Tuesday, March 20, 2012 9:58 AM
  • Hi MH,

    Would you please show more snippet to explain the first question? And do you notice the comment part in my snippet? I think that is the answer for your second question.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, March 21, 2012 7:03 AM
    Moderator
  • Dear Tom,

    Here a second version of the code snippet:

    Dim sp As Shape 
    Set sp = Application.ActiveDocument.Shapes(1)
    
    'Show sp's Properties before manipulation (shows 0, 0)
    MsgBox sp.ThreeD.BevelTopInset & " " & sp.Rotation
    
    'Manipulate sp
    sp.ThreeD.BevelTopInset = 10 sp.Rotation = 27
    
    'Show sp's properties after manipulation (shows 0, 27)
    MsgBox sp.ThreeD.BevelTopInset & " " & sp.Rotation
    Please execute the macro. As you see, both manipulation commands are executed since bevel inset and rotation change obviously. But the MessageBox still shows msoBevelNone (or enum value 0). So I cannot conclude from data, whether the user changed the bevel. But I would like to since my AddIn can only evaluate data and does not have an eye on the shape.

    Why does the rotation value change, and the bevel value does not? Where can I get the information from?

    My second question has nothing to do with conversion to or from inline shapes. Here is the according screenshot again:

    The image is manipulated with the help of a dialog which is called "picture shape". It does not matter, whether Word.Shape or Word.InlineShape object. The functionality (as shown in the screenshot) adds a funny-shaped clipping/frame. To Word.Shape and Word.InlineShape objects.

    For both, Word.Shape and Word.InlineShape objects I cannot locate a member, that I can conclude that funny-shaped clipping/frame property from. Do you? How is that funny-shaped clipping/frame added by macro (unluckily there is no macro recording for that)?

    Cheers,
    MH

    • Edited by MH_dhs Monday, March 26, 2012 2:23 PM
    Monday, March 26, 2012 2:13 PM