Using Visio functions (TEXTWIDTH or TEXTHEIGHT) in IronPython

Started by rahulkd, June 22, 2016, 04:39:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rahulkd

I am working in a project where I need to resize the shape  in visio 2007 dynamically based on the size of the text in the shape.
I went through functions like TEXTWIDTH and TEXTHEIGHT to change the shape's width and height based on the shape's text.

But I am not been able to use these functions in my Iron Python code, its throwing an error saying its not defined.
How to use these visio functions programmatically maybe in IronPython????
 

wapperdude

Never used Python language, but, the general technique should be similar  VBA.  Namely, you don't directly use  shapesheet functions.  Rather, you would use the code to insert the function into the desired shapesheet location.  In VBA, this is done  inserting the desired formula with all of the appropriate arguments.

I'd suggest manual inserting the formula and testing it to be sure you have the desired behavior.  Once you have the exact formulation, then use your code to insert that exact formula into the shapesheet cell.

Wapperdude
Visio 2019 Pro

Yacine

You're working with Saveen Reddy's tools?
I think you can consult him directly on his blog page. (Google is your friend)
Yacine