Trouble with RTFData to String

I have this method from Xojo 2013 which is not placing RTFData string into the string myStr in Xojo 2018.

dim myStr as String myStr=rs_letter.Field("wp_letter_").StringValue myStr= DefineEncoding(myStr, encodings.UTF8) WordProcessor_container1.TextArea1.StyledText.RTFData = myStr

When I check for data in rs_letter.Field(“wp_letter_”).StringValue, it looks exactly like the RTFData in Xojo 2013, but it doesn’t seem to transfer to myStr. When I look in the debugger, myStr is empty.

Break at the dim, and step each line to see which clears it.

Figured it out.

Switched rs_letter.Field(“wp_letter_”).StringValue to rs_letter.Field(“wp_letter_”).NativeValue and everything works again.

Thanks.

You know that the rtf code already have a text encoding ?

If you do not know, read the file as text and check the rtf “header” (text definition before {\fonttbl) with the rtf language reference.

Check this page (it also have a link to the rtf reference in the Microsoft web pages):

https://en.wikipedia.org/wiki/Rich_Text_Format

Try this: https://github.com/deblauweg/RTFBox

Dim rtf As New clsRTFBox_Data
Dim strText As String

rtf.SetRTF(strRTF)
strText = rtf.GetText

Whoa! Look at the license first.

You MUST make your source code available if you use this! :stuck_out_tongue:

… but you CAN use it commercially. Yeah, right. :wink:

And Davis Schlam does not show sign of life since two days…

Is it? I just want changes that were made to these classes to return and not be held liable, not your entire sourcecode.

That’s how I read https://tldrlegal.com/license/eclipse-public-license-1.0-(epl-1.0)

I guess the one to use is LGPL? see for example xojo-option-parser/LICENSE.md at master · jcowgar/xojo-option-parser · GitHub

GNU Lesser General Public License v3.0

Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications under the same license or the GNU GPLv3. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work through interfaces provided by the licensed work may be distributed under different terms and without source code for the larger work.

Just so you know: changed the license to LGPLv3