Having trouble with MLeader.MText.ConvertFieldToText() me
No error is thrown, but the field is not converted
- Is there an extra step required?
Also having trouble with fields in dimension text.
Oddly, when I pick a dim text it seems nothing hap
While the command is still running, pick the same
Exit the command, edit the dim text normally and
- Is there an extra step required to convert dim t
My code is attached. Comments are welcome.
Solved! Go to Solution.
If the contents of MText contains fields, this function converts them to text and removes the fields. It does not evaluate the fields before converting them
As my colleague mentioned, the field is not evaluated during this conversion.
If you want the updated text, you can set the MText content by evaluating the field on your own.
Here is a sample code snippet to evaluate a field from the MText :
Dim myML As MLeader = myTrans.GetObject(mySelObj.ObjectId, OpenMode.ForWrite) Dim myMLT As MText = myML.MText myMLT.GetField() Dim fieldId As ObjectId fieldId = myMLT.GetField() Dim fld As Field = myTrans.GetObject(fieldId, OpenMode.ForWrite) fld.Evaluate() Dim fldValue As String fldValue = fld.Value.ToString() ' Set the MLeader text based on evaluated field value
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register