This project has moved. For the latest updates, please go here.

Text and MText Values

Dec 10, 2013 at 4:06 PM

When getting the Value from a Text or MText entity I often get values that look like this

\fArial Narrow|b0|i0|c0|p34|;COLD ROOM


{\fArial Narrow|b0|i0|c0|p34;NURSES}

Obivously the text value should be COLD ROOM or NURSES. Why am I getting all the other info too? And is there a way to clean this other info out rather than me having to parse the data through some kind of clean up method?


Rob Smart
Dec 11, 2013 at 6:41 PM
The Value property contains the whole information is saved in code 1 for the Text and MText entities, and this includes the formatting options. At the moment I cannot do much about it since I don't have enough information to make a proper parser for it, I am not even sure if this information in publicly available. As far as I know, only the MText entity can have this kind of formatting codes, in the library code you can find a few of them in the MTextFormattingOptions class, but this might have changed in newer AutoCad versions.

The only recommendation I can give you is to avoid using any kind of formatting and restrict yourself to the TextStyle options. The use of XData might be another way to pass information but that could be a lot more restrictive.