none
Do I need to update ...? RRS feed

  • Question


  • ... the shapes that I need the adjustment-values from? If so how would I do that?

    Hi,

    I have discovered something really weird. I am programming something in VB.Net for PowerPoint. Some of the autoshapes in PP have adjustments. Now have a look at autoshape no 47 (it is the same with all similar arrow shapes; see code to insert autoshape47 below).

    As of my knowledge the value of the adjustments is always a multiple of the shorter shape side of the autoshape. In this case if you maximize the width of the arrow-tip the second code snippset shows factor 5 for the arrow-tip width -  because the arrow-width is 5 times as long as the shape height (shape height = shorter side of the shape = reference side as up to here).

    In the next step leave everything as it is but make the shape height twice or three times as large as the current shape width. Now by doing this the reference for the adjustments has changed. Not the height but the width is now the shorter side of the shape. Therefore if things would be logic the adjustment for the width of the arrow-tip should become 0.5 because the arrow-tip is half as wide as the shapes width.

    And here is my problem: The factor shown for the arrow-tip width has NOT changed from 5 to 0.5 ! (Just run the code again!) It stayes to be 5 – which is wrong, I think?!?!

    As soon as you touch the adjustment for the arrow-tip width it will change to the right (new) value.

    My question: Is there any good idea how to ALWAYS receive the correct values? So I would be able to work with the correct value further on in my program. I do not want to “hope” that the user “takes care” of this issue.

    Many thanks.

    And here is the code:
    Insert AutoShape 47 on a new slide:

    		Private Sub InsertAutoShape47() 
    		 
    				Dim oActiveWindow As Object = Me.HostApplication.ActiveWindow()
    				Dim oPresentation As Presentation = oActiveWindow.Presentation
    		 
    				Dim oSlides As PowerPoint.Slides = oPresentation.Slides
    				Dim oCustomLayout As CustomLayout = oSlides(1).CustomLayout
    				Dim oSlidesNew As PowerPoint.Slides = oPresentation.Slides
    				Dim oSlide As PowerPoint.Slide = oSlidesNew.AddSlide(oSlides.Count + 1, oCustomLayout)
    				Dim oSlideShapes As PowerPoint.Shapes = oSlide.Shapes
    				Dim oShapenew As PowerPoint.Shape = oSlideShapes.AddShape(47, 250, 250, 200, 20)
    		 
    		 
    				GC.Collect()
    				GC.WaitForPendingFinalizers()
    				GC.Collect()
    				GC.WaitForPendingFinalizers()
    		 
    		End Sub  

    Get the adjustment values:

            Private Sub GetArrowTip()   
    
                Dim oActiveWindow As Object = Me.HostApplication.ActiveWindow()
                Dim oSelection As Selection = oActiveWindow.Selection
                Dim oPresentation As Presentation = oActiveWindow.Presentation
                Dim oShapeRange As PowerPoint.ShapeRange = oSelection.ShapeRange
                Dim A, B, C, SWidth, SHeight As Double
    
                Dim oSlides As PowerPoint.Slides = oPresentation.Slides
                Dim oCustomLayout As CustomLayout = oSlides(1).CustomLayout
                Dim oSlidesNew As PowerPoint.Slides = oPresentation.Slides
                Dim oSlide As PowerPoint.Slide = oSlidesNew.AddSlide(oSlides.Count + 1, oCustomLayout)
                Dim oSlideShapes As PowerPoint.Shapes = oSlide.Shapes
                Dim oShapenew As PowerPoint.Shape = oSlideShapes.AddShape(47, 250, 250, 200, 20)
    
    
                If oShapeRange.Count = 1 Then
    
                    Dim oShape As PowerPoint.Shape = oShapeRange(1)
                    Dim oArrowAdjustment As PowerPoint.Adjustments = oShape.Adjustments
                    Dim oShapeType As Integer = oShape.AutoShapeType
    
    
                    Select Case oShapeType
                        Case 47
                            A = oArrowAdjustment.Item(1)
                            B = oArrowAdjustment.Item(2)
                            C = oArrowAdjustment.Item(3)
                            SWidth = oShape.Width
                            SHeight = oShape.Height
                        Case Else
                            MsgBox("Please select autoshape no 47.")
                            Exit Sub
                    End Select
    
                Else
                    MsgBox("Please select one shape.")
                    Exit Sub
                End If
    
                MsgBox("Arrow width: " & B & vbCrLf & "Arrow length = " & C & vbCrLf & "Shape height: " & SHeight & vbCrLf & "Shape width: " & SWidth)
    
                GC.Collect()
                GC.WaitForPendingFinalizers()
                GC.Collect()
                GC.WaitForPendingFinalizers()
    
            End Sub
    
    
         

                                                                                                                                              


    Sunday, January 17, 2016 8:09 PM

All replies

  • Hi MoD66,

    >> The factor shown for the arrow-tip width has NOT changed from 5 to 0.5 ! (Just run the code again!) It stayes to be 5 – which is wrong, I think?!?!

    Did you mean you could not set arrow-tip width? Based on your code, I did not find any code to set Adjustments.Item. And I tried to use your code, but I failed. What your project type is, is it vsto? What is “Me.HostApplication”? It would be helpful if you could share us a simple demo to reproduce your issue through OneDrive.

    In addition, the link below might be useful to you.
    # Adjustments Object (PowerPoint)
    https://msdn.microsoft.com/EN-US/library/office/ff744037.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, January 18, 2016 6:43 AM
  • Hi Edward,

    many thanks for your answer. I have made a small video with camstudio to demonstrate what my problem is.

    I hope this makes it clear. If you have any further questions, please do not hesitate to ask.

    The problem appears with all adjustment.items if they are not "updated" or manually touched again.

    Here is the link to OneDrive:

    Video question

    Video Question (unshortend link)

    Many thanks for your help.

    Best Regards,

    Jens

    Monday, January 18, 2016 12:56 PM
  • Hi Jens,

    Could you share us a simple demo project through OneDrive, and then we could test at our side?

    In addition, I have watched this video, and I want to confirm that did you mean the arrow length did not change with code, but it changed with manually touched?

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, January 19, 2016 7:29 AM
  • Hi Edward,

    thanks for your reply. I was actually talking about the arrow-width. But it is the same for all adjustment-items.

    1. Change the size of the shape and

    2. the values that the code is working with will not change accordingly. Why not? Or better: how can I make sure that the values in the code will change accordingly?

    Here is a link to my project. Notice: I am using Add-In-Express

    for my development, as it makes some things easier.

    I hope the provided files work for you?

    Many thanks.




    • Edited by MoD66 Tuesday, January 19, 2016 1:48 PM
    Tuesday, January 19, 2016 1:47 PM
  • Hi MoD66,

    I am not familiar with Add-In-Express, based on your description, you want to change the adjustmentitems. I made a test with powerpoint add-in and it worked correctly. Here is a simple code:

    Imports Microsoft.Office.Tools.Ribbon
    
    Public Class Ribbon1
    
        Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
    
        End Sub
        Dim sli As PowerPoint.Slide
        Dim s As PowerPoint.Shape
        Private Sub addShape_Click(sender As Object, e As RibbonControlEventArgs) Handles addShape.Click
    
            sli = Globals.ThisAddIn.Application.ActivePresentation.Slides(1)
            s = sli.Shapes.AddShape(47, 10, 10, 250, 190)
        End Sub
    
        Private Sub changeShape_Click(sender As Object, e As RibbonControlEventArgs) Handles changeShape.Click
            With s.Adjustments
                .Item(1) += 0.1
                .Item(2) += 0.2
                .Item(3) += 0.3
            End With
        End Sub
    
        Private Sub getShape_Click(sender As Object, e As RibbonControlEventArgs) Handles getShape.Click
            With s.Adjustments
                MsgBox("item(1): " & .Item(1) & "; item(2): " & .Item(2) & "; item(3): " & .Item(3))
            End With
        End Sub
    End Class
    

    With above code, you could click addshape, and click getShape, it would return the current Adjustments.Item. Then you could click changeShape, and click getShape, you would find the value has changed.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, January 20, 2016 7:39 AM
  • Hi Edward,


    many thanks for your code.

    Unfortunatly until now I guess I was not capable enough to get my issue across to you. Sorry.

    I have used your code to reproduce my issue again. And then I have made a new video to explain my issue.

    Next try video

    There is one thing I would like to let you know (probably you are aware of this?):

    I have discovered, if I want to know the absolute length of an adjustment I have to multiply the shorter edge of the shape with the adjustments value. E.g. Shape.Width is 240 and Shape.Height is 60 and the adjustment.item(2) is 2.0 then the width of the arrow-tip is 60 x 2.0 = 120.
    Shape.Width = 240
    Shape.Height = 60  (reference for the adjustemnts)
    Absolute Arrow Tip Width = 60 x 2.0 = 120
    Adjustment.item(2) = 2.0

    Now if the Shape.Height of this shape changes to 480 (420 + 60) the Shape.Width (240) becomes the shorter edge. Let's assume the absolute width of the arrow tip has not changed. In this case we have:
    Shape.Width = 240 (now the reference for the adjustemnts)
    Shape.Height = 480
    Absolute Arrow Tip width = 120
    Adjustment.item(2) = 120 / 240 = 0.5

    But insted (you can see in the video) the software is still working with the adjustment value of 2.0 which I think is wrong?!?

    What do you think?

    Do you have any idea to solve this problem?
    It messes up my entier code.

    Many thanks.

    Wednesday, January 20, 2016 3:14 PM
  • Hi MoD66,

    Your video is broken. I assume I know your issue now. Do you mean the Adjustment.item(2) did not change when you change the Shape.Width and Shape.Height?

    >> if I want to know the absolute length of an adjustment I have to multiply the shorter edge of the shape with the adjustments value

    I am afraid the absolute length of an adjustment is not related with the shorted edge. It is related with the corresponding edge. With my above code, you could find the Adjustment.item(2) would not change no matter how the Shape.Width and Shape.Height changed. It is related with position of item in the edge of shape.

    With my above link, you would find below:

    Generally the value 0.0 represents the left or top edge of the shape and the value 1.0 represents the right or bottom edge of the shape. Valid values correspond to valid adjustments you can make to the shape manually. For example, if you can only pull an adjustment handle half way across the shape manually, the maximum value for the corresponding adjustment will be 0.5.

    Since each adjustable shape has a different set of adjustments, the recommended way to verify the adjustment behavior for a specific shape is to manually create an instance of the shape, make adjustments with the macro recorder turned on, and then examine the recorded code.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, January 21, 2016 7:38 AM
  • Hi Edward,

    many thanks for your continuing effort! I appreciate that very much.

    I am sorry to tell you that I disagree on your opinion that the adjustments are related to the edge where they are positioned. If that would be true, you would never have a value above 1.0 right?

    But that is not the case! I have made a new film showing you that the values of the adjustemnts can be larger than 1.0.

    And I have uploaded my film from yesterday again (If it does not work in your browser please download it. That worked for me.).

    Second try to explain my issue

    Adjustment values above 1.0

    Many thanks.

    Thursday, January 21, 2016 1:32 PM
  • Hi Edward,

    are you still listening?

    Maybe you went on vacation?

    I would be very happy to hear from you again.

    Many thanks.

    Tuesday, January 26, 2016 2:21 PM
  • Hi MoD66,

    As above link, it says below, I think it could be larger than 1.0.

    For shapes such as connectors and callouts, where the values 0.0 and 1.0 represent the limits of the rectangle defined by the starting and ending points of the connector or callout line, negative numbers and numbers greater than 1.0 are valid values.

    I am not sure your requirement. Do you mean you want to get arrow-tip width? Could you share us how you tried and when it did not work? In addition, I try to check your video, but I failed. I think you could try to visit it in other pcs to check whether your link worked.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, January 27, 2016 6:49 AM
  • Hi Edward,

    Thanks for your replay.

    I have made a new video with new settings from scratch - and I hope it will work this time.

    In addition I have followed this instruction to make sure that the video works this time.

    New Video

    If nothing works, here is what you can test by your own.

    1.  Use the code I provide below

    2. Run it on PowerPoint

    3. Use the "AddShape"-Button twice (move one shape to the right so they would not be on top of each other)

    4. Take e.g. the shape to the right and maximise the width of the arrow-tip (pull the yellow button to the middle of the shape)

    5. Select both shapes and use the "changeShape"-Button to increse the height of the two shapes

    6. Select both shapes and use the "getShape"-Button to get the values of the adjustemnts for the two shapes

    Result: Both shapes are absolutely identical but the adjustement values in this example for item(2) are different (2.0 vs. 0.5). So from my point of view it absolutely depends on the user how he/she is handling the shapes. In some cases my program will then continue to work with a value of 2.0 in other cases it will continue to work with a value of 0.5. And that screew up my program. In my opinion the 2.0 is wrong. The shape needs to "update" it's adjustement-values after any change of it's shape-dimensions.

    I hope I got my issue accross? I would be more than happy to have/find a solution for my problem.

    Many thanks for your time and help.

    Here is the code:

    Imports Microsoft.Office.Interop.PowerPoint
    Imports Microsoft.Office.Tools.Ribbon
    
    Public Class Ribbon1
    
        Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
    
        End Sub
    
        Dim sel As PowerPoint.Selection
        Dim sR As PowerPoint.ShapeRange
        Dim s As PowerPoint.Shape
        Dim sli As PowerPoint.Slide
        Dim doc As DocumentWindow
    
        Private Sub addShape_Click(sender As Object, e As RibbonControlEventArgs) Handles addShape.Click
            sli = Globals.ThisAddIn.Application.ActivePresentation.Slides(1)
            s = sli.Shapes.AddShape(47, 100, 50, 240, 60)
        End Sub
    
        Private Sub changeShape_Click(sender As Object, e As RibbonControlEventArgs) Handles changeShape.Click
            doc = Globals.ThisAddIn.Application.ActivePresentation.Windows(1)
            sel = doc.Selection
            sR = sel.ShapeRange
            If sR.Count = 1 Then
                Dim s1 As PowerPoint.Shape = sR(1)
                With s1
                    .Height += 420
                    '.Width += 0.2
                End With
            End If
    
        End Sub
    
        Private Sub getShape_Click(sender As Object, e As RibbonControlEventArgs) Handles getShape.Click
            doc = Globals.ThisAddIn.Application.ActivePresentation.Windows(1)
            sel = doc.Selection
            sR = sel.ShapeRange
            Dim message As String = Nothing
            If sR.Count > 0 Then
                For i = 1 To sR.Count
                    Dim s1 As PowerPoint.Shape = sR(i)
                    With s1.Adjustments
                        message = message & "s" & i & ": " & "item(1): " & .Item(1) & "; item(2): " & .Item(2) & "; item(3): " & .Item(3) & vbNewLine & vbNewLine
                    End With
                Next
                MsgBox(message)
            End If
        End Sub
    
    End Class
    


    Sunday, January 31, 2016 3:14 PM
  • ... and here is the other video with new coding - that I think you already know.

    Sunday, January 31, 2016 3:29 PM
  • Hi Edward,

    were you able to see my new video? Or is it broken again?

    Wednesday, February 3, 2016 3:34 PM
  • Hi MoD66,

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly
    appreciated.

    Sorry for any inconvenience and have a nice day!

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, February 4, 2016 9:28 AM
  • GREAT!

    I'm so glad to hear from you.

    Yes, I will be patience. (I'll try my best ;-) )

    Thursday, February 4, 2016 9:55 AM
  • Hi Edward,

    how are you doing?

    Are you getting closer to any solution or work-around?

    Kind regards,

    MoD66

    Sunday, February 14, 2016 9:30 AM
  • ... will there be any answer?

    Wednesday, February 24, 2016 7:51 AM
  • Edward .... ?????

    Friday, March 11, 2016 11:28 AM
  • This is really sad ....
    Monday, April 18, 2016 8:25 AM
  • Hi MoD66,

    Senior engineers did not give me any suggestions, your patience will be greatly appreciated.

    If it is an urgent issue, I will suggest you contacting the Microsoft professional support so that our engineers can work closely with you to troubleshoot this issue.

    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, April 19, 2016 2:17 AM