I have a shape where I want to change the formula of a control.
I use this code to rotate the shape and then update the Controls:
shape.SetAngle(angle * (Math.PI / 180));
shape.Controls.GetControlFromName("IndicatorPosition").X.Ufe.F = $"Width*{bomPositionX}";
shape.Controls.GetControlFromName("IndicatorPosition").Y.Ufe.F = $"Height*{bomPositionY}";
shape.RefreshData();
After saving the diagram and opening it in Visio, I see that the Control formula is updated correctly, but the shape is not rendered accordingly. If I change the formula in Visio, I see that the shape is updated immediately.
I found this old thread here: Controls in Shapes doesnt work
Unfortunately, the suggested solution to add shape.RefreshData() is already in my code and still not fixing the problem.
@thomasschissler
Thanks for sharing us the sample code.
Could you please also share the template file with the control in it?
We will check and assist you accordingly.
Thanks.
Aspose_ManipulatingShapes.zip (49.4 KB)
This is the code I am using including the input and output file.
Strangely now it does not even have the formula in the shape data but replaced it with values.
But still, you can see the effect I am describing in this issue.
As you can see in this video, if I select the shape, the grip point for that circle with “##” is above the shape, but the circle is rendered below. When I then go into the shape data and just confirm the value for Controls.IndicatorPosition.Y, the circle is repositioned to the position I expect it to be right after creating the file with Aspose.
2025-03-10_10-20-04.mp4
So I have two questions:
- Why is the formula replaced with values and how can I ensure that the formula is stored in my file?
- Why is the circle not positioned according to the values in the shape data?
Let me know if I can provide any other information to support you.
@thomasschissler
Thanks for the template file and screenshots.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file. We will evaluate your issue further.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): DIAGRAMNET-53691
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.