When encountering mtext entities that contain formatting codes like this example:
“FLANGE 300# {\C256;RFWN 0.218"" WT} A694 F52”
On screen it looks like: FLANGE 300# RFWN 0.218" WT A694 F52
AutoDesk does have the ExplodeFragments function to explode the mtext into regular text with no formatting with this code:
' explode the text
Using mt = New MText()
mt.Contents = strCell
' Explode the text fragments
mt.ExplodeFragments(Function(a, b)
If a IsNot Nothing Then
' Assuming we have a fragment, use its text
' to set the cell contents
strCell = a.Text
End If
Return MTextFragmentCallbackStatus.Continue
End Function)
End Using
However, this does have a bug, in which if you were to use that code, all you would wind up with is:
A694 F52
Which the text is incomplete and worthless.
Autodesk has suggested to create an elaborate regex pattering from the code lists on the following pages:
However that is beyond my capabilities.
Does Aspose.CAD offer a function to accomplish converting mtext string with formatting to regular text?