Xbasic

*BIN_TO_RTF Function

Syntax

RTF_Text as C = *BIN_TO_RTF(data as B)

Arguments

dataBinary

The contents of a RTF memo field.

Returns

RTF_TextCharacter

An ASCII encoded representation of the RTF text.

Description

Convert from binary to rtf.

Discussion

The *BIN_TO_RTF() function converts binary RTF text to ASCII encoded RTF text.

Example 

The following example reads RTF binary text from the AlphaSports a_alphasports_help table, writes it to an HTML file, and displays it in a browser:

dim tbl as P
dim rtftext as C
tbl = table.open("a_alphasports_help")
tbl.fetch_first()
rtftext = *bin_to_rtf(tbl.notes)
? rtftext
= {\rtf1\ansi \deff0{\colortbl;\red0\green0\blue0;\red0\green128\blue0;}{\fonttbl{\f0\fswiss Tahoma;}{\f1\fnil Verdana;}}{{\b \f1 \cf1 \fs28 Payment Method\par }{\f1 \cf1 \fs20 \par The PAY_METHOD field provides the user with a list of acceptable payment methods.  Field rules define the payment methods, which are:\par \par \tab Amex\par \tab MCard\par \tab Visa\par \tab Check\par \tab Cash\par \tab Other\par \tab No Charge\par \par }{\b \f1 \cf1 \fs20 See Also:\tab }{\field{\*\fldinst{\ul \f1 \cf2 \fs20 HYPERLINK "Credit Card Number"}}}{\f1 \cf1 \fs20 \par \tab \tab }{\field{\*\fldinst{\ul \f1 \cf2 \fs20 HYPERLINK "Credit Card Expiration"}}}{\f1 \cf1 \fs20  \par \tab \tab }{\field{\*\fldinst{\ul \f1 \cf2 \fs20 HYPERLINK "COND1 Conditional Object"}}}{\f1 \cf1 \fs20  }}}

save_to_file(*rtf_to_html(rtftext), "C:\temp\example.html")

sys_open("C:\temp\example.html")

See Also