Microsoft Visio Adding a Text Box
Hello,
I was wondering if I could possibly get some help in the area of automating MS Visio 2007. I am able to add lines, shapes, things of that sort, but I simply want to add a text box to the file. Using the activeX control I am able to add text to shapes, but this is not what I want. I messed around with the idea of creating an empty shape and adding text that way but this did not work.
Does anyone have any clue how to go about doing this in the active x control. The resources for Visio are terrible and there does not seem to be much information otherwise on the internet. Thanks in advance for your help!
Matthew ZimmermanPosted Dec 20, 2010, 7:01 PM
I did find a little work around for this. It is not a preferred method but it is the easiest solution that I have currently.
What you can do to solve this problem is make a new shape, say a rectangle, set its text, and then hide the filling and also the lines that are around it by setting their respective styles to "none".
Visio.Shape textBox = Visio.Page.drawRectangle(x1,y1,x2,y2);
textBox.Text = "Some Text Here";
textBox.LineStyle = "None";
textBox.Style = "None";
That is how I got it to work. Now of course this is not ideal, but it is working solution. If anyone else has any suggestions please let me know. I would greatly appreciate the help. Thanks in advance.