I have a memo field into which the user pastes text from various online sources. I made it an RTF field, because some of the formatting is useful - mostly italics for species names, and occasionally bold. Unfortunately, pasting web text often brings in a huge amount of superfluous formatting information, usually having to do with character substitution in foreign languages.
The text fills up with garbage like:
<font face=Arial size=3 color=black>ý</font>
<font face=PalatinoLinotype-Roman size=3 color=black> pušt</font>
<font face=Arial size=3 color=black>í</font>
<font face=PalatinoLinotype-Roman size=3 color=black>k bělav</font>
<font face=Arial size=3 color=black>ý</font>
<font face=PalatinoLinotype-Roman size=3color=black> (</font>
where the red characters are what should be in the box, and all the rest is Access's attempt to switch fonts around in an attempt to correctly display a character that may not be available in some font, but is in another. Naturally, this balloons the content enormously. What should be an article of a few hundred words swells to tens of thousands of characters in the RTF field, with all the problems that such inflation carries.
When I manually select the entire text and give a formatting command to make it all one font, this junk disappears. Is there a way to call this function from VBA?
Before someone tells me to use the PlainText function, I do NOT want to get rid of ALL the formatting. I want to make all the text one font face, but leave things like bold, italics and possibly color.
Access obviously knows how to do this, and I would like to use that ability, instead of having to code up an enormous kludge to slog through all the RTF tags.
The text fills up with garbage like:
<font face=Arial size=3 color=black>ý</font>
<font face=PalatinoLinotype-Roman size=3 color=black> pušt</font>
<font face=Arial size=3 color=black>í</font>
<font face=PalatinoLinotype-Roman size=3 color=black>k bělav</font>
<font face=Arial size=3 color=black>ý</font>
<font face=PalatinoLinotype-Roman size=3color=black> (</font>
where the red characters are what should be in the box, and all the rest is Access's attempt to switch fonts around in an attempt to correctly display a character that may not be available in some font, but is in another. Naturally, this balloons the content enormously. What should be an article of a few hundred words swells to tens of thousands of characters in the RTF field, with all the problems that such inflation carries.
When I manually select the entire text and give a formatting command to make it all one font, this junk disappears. Is there a way to call this function from VBA?
Before someone tells me to use the PlainText function, I do NOT want to get rid of ALL the formatting. I want to make all the text one font face, but leave things like bold, italics and possibly color.
Access obviously knows how to do this, and I would like to use that ability, instead of having to code up an enormous kludge to slog through all the RTF tags.