.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating multi-line Mtext

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
479 Views, 5 Replies

Creating multi-line Mtext

I'm having trouble getting an mtext entity with multiple lines of text. I've tried adding vbCrLf, vbLf, vbCr, \P, \n to the Text property but the end result is always a single, wrapping line of text in the mtext entity.

Anyone have an idea what I'm missing?

Thanks in advance.
5 REPLIES 5
Message 2 of 6
MarkPendergraft
in reply to: Anonymous

i use vbcrlf all the time with mText, and i haven't had any issues. perhaps you could provide the code in question.
Message 3 of 6
Anonymous
in reply to: Anonymous

I can't put all the code here due to privacy policies in my company but I have posted the mtext creation bit below...

...code above...
Dim PtA As Geometry.Point3d = oEd.GetPoint(vbCrLf & vbTab & "Select Note Insertion Point: ").Value

Dim strText As String = cboSeries.Text & vbCrLf & cboStyle.Text & vbCrLf & cboType.Text & vbCrLf & cboExtra.Text

Dim oMtext As New MText
With oMtext
.Width = 300.0
.TextHeight = 8.0
.Location = PtA
.Attachment = AttachmentPoint.MiddleCenter
.SetContentsRtf(strText)
End With

oBtr.AppendEntity(oMtext)
oTrans.AddNewlyCreatedDBObject(oMtext, True)
End If
...code below...

Hopefully it's something stupid I'm overlooking.
Message 4 of 6
MarkPendergraft
in reply to: Anonymous

Sounds like a crappy company 🙂

set

.setContentsRtf(strText)

to

.Contents = strText

-Mark Pendergraft
Message 5 of 6
Anonymous
in reply to: Anonymous

>> .Width = 300.0

Change that number to an smaller value ie 4.0.... and see what happens.
Message 6 of 6
Anonymous
in reply to: Anonymous

Changing to .Contents = strText did the trick!

Thanks 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost