Thu Mar 28, 2019 2:58 am
It seems that another search is destroying the underline. That is, I have a search for "IV epinephrine". It finds the partially underlined example:
IV epinephrine
but in doing so, destroys the underline. Is this possible?
I tested removing the search for "IV epinephrine" and now everything works fine.
I tested other cases in other files, and indeed, it seems that FindAllString(), when it finds a TextRange that doesn't start with an underline, destroys any later underline. Similarly, if it starts with an underline but then stops, it seems to make the whole TextRange underlined.
I understand why this happens, because you only have one CharacterFormat for a TextRange. It seems that a List of CharacterFormats would be more appropriate to avoid this destructive quality of the search!