Appending FormattedText - Labels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey
Struggling a little with appending a drawing view label. My labels are like this
I am trying to append some text to the location of the red box. If the text is already there, i want to remove it and replace it. This is how i am doing it
Dim RefText As String = "-REF-"
'example text - (SCALE - 1" = 1'-0") -REF- A101/2
'split the string at RefText to capture only the left side
Dim ChkSplitStr() As String = Split(ThisView.Label.Text, RefText)
'find the end of the formatted text next to the scale
If Strings.Right(ChkSplitStr(0), 1) = ")" Then
'split the formatted text at RefText
Dim SplitStr() As String = Split(ThisView.Label.FormattedText, RefText)
'create the StyleOverride text for the append text
Dim FormattedString as String = "<StyleOverride Font='Arial' FontSize='.025' Bold='True' Italic='False' Underline='False'>-REF- A101/2</StyleOverride>"
'remove any right side text by using the left side formatted text
ThisView.Label.FormattedText = SplitStr(0) & FormattedString
Sometimes it works, sometimes it doesnt. Mostly, i am getting the actual formatted string appended to the label as text instead of formatted text so, my label ends up like this
What is the best way to append FormattedText?
Thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.