Xbasic

RTF_TO_TEXT Function

Syntax

Text_String as C = rtf_to_text(B field_data )

Arguments

field_data

A blob variable containing RTF text.

Description

RTF_TO_TEXT() returns a Text_String, referenced by the variable Blob_RTF. This function is useful for extracting the data in a RTF memo field.

This example shows how to read the value of RTF table field named RTFMEMO in record number 32 of the Customer table.

dim tbl as P
dim bin as B
tbl = table.open("customer") 
tbl.fetch_goto(32) 
bin = tbl.RTFMEMO

? rtf_to_text(bin) 
= "this is some memo text"

This example shows how to create and manipulate an RTF object.

dim ptr as P
dim bdata as B
dim cdata as C
' create the RTF object
ptr = rtf.create("Alpha!")
' retrieve the binary data
bdata = ptr.Binary_Text
' convert it to text
cdata = rtf_to_text(bdata)
? cdata
= "Alpha!"

See Also