Inconsistent results extracting text from drawing table

I'm working on an application where I'm extracting text from a table selected in the active drawing file. I'm running into issues getting the text out of the cell with SldWorks.TableAnnotation.DisplayedText2

On the drawing, the table (which itself is generated by a macro at some point) shows a plain column of text

However, I'm seeing issues where DisplayedText2 comes back with this text wrapped with what looks like markup tags defining the font color. I'd initially just accepted I'd have to deal with this and made a filter function to get the text between the tags.

That works most of the time, except sometimes it seems that DisplayedText2 comes back with just the opening tag, breaking my function. 

Before I go ahead and make my function deal with this I figured I'd ask - is there a native API way to actually just get the displayed text? "DisplayedText2" evidently does not actually just send back the displayed text. And I see the same issue with the Text2 property. 

Answers 1
JB
JB 2025-05-09

I don't think so... also, I'm curious what kind of code is creating the table.  SW formatting markup doesn't close.  It's a single tag that affects all text following it.    The "" doesn't actually do anything.  So I wonder why it's there.  See the attached pic.  If you want to explore SW's tag formatting, check out my note browser macro, also attached.  Use the UI to create a note that has some formatting you want to learn markup for.  Then run the macro, pick the note, and hit "Get new note".  You can then play with the text and markup, and hit "replace propertylinkedtext" to see the result of your edits.

comment imagecomment imagecomment imagecomment image