70001321 I would like to get the actual text of an Mtext object

Article 70001321
Type Wish
Product Engine
Version 7014
Date Added 4/25/2018
Fixed 7.7015.0.2 (4/25/2018)
Submitted by Yannis Makarounis

Summary

I would like to get the actual text of an Mtext object

Solution

In version 7015 we added a new method to the vdMtext object like below:

Get an array of strings representing the actual text of the Mtext without the extra commands.
Every line of the Mtext is represented as a different string. Note that empty lines produce an empty string.
public vdArray GetActualStringArray()
 
 
Simple code on how to use this method in C#:

                gPoint pt = null;
                vdFigure fig = null;
                doc.Prompt("Select a vdMText object");
                doc.ActionUtility.getUserEntity(out fig, out pt);
                doc.Prompt(null);
                vdMText txt = fig as vdMText;
                if (txt == null) return;
                vdArray ret = txt.GetActualStringArray();

                string messageboxstr = "";
                foreach (string item in ret)
                {
                    messageboxstr += item + "\r\n";
                }
                MessageBox.Show(messageboxstr);

Send comments on this topic.