Dev Luv: Processing Text in Visio


There are two ways to process the text in shape text. You can use Shape.Text, which returns a string that contains placeholders for fields. I would use Shape.Text if I just wanted to read or write a string that did not contain any fields.

 

If you think or know that your shapes contain fields, you’ll want the fully expanded shape text. In that case, you’ll need to use Characters.Text on the Shape.Characters object. The Characters object has a little more complexity to its use for shape processing but also gives you a lot more functionality – for example, methods and properties to cut, copy, and paste shape text to the clipboard, or do formatting on specific characters.

 

Check out the Text Fields and Formatting sample in the SDK’s Code Librarian for C#, VB.NET, and VB examples on how to use the Characters object to change shape size so that the text will not overflow the shape and format the text.

 

 -- Mai-lan

 

This posting is provided "AS IS" with no warranties, and confers no rights