Crystal Reports Formula to parse RTFtext based on font format ie Bold and Italic – Education Career Blog

I have a column of RTF data that looks like the following:

The terms or definitions to be used in this document are:
Daily Operator. Used when the user is…….etc..

Using crystal reports I would like to grab just the BOLD text using a formula or equivalent.

I keep getting the RTF markup instead of standard text. Here is an example that I used to grab first 10 characters.

DIM convertedText as String
convertedText = cstr({table.DefinitionRTF})
FORMULA = MID(convertedText, 1, 10).

Looking ahead a bit more, how would one determine where the bold or italic Starts. Can you check for crBOLD and return the characters index position?

Thanking all in advance.

,

No, Crystal does not have the built-in commands to parse RTF objects by font properties. The purpose of Crystal Reports is to present formatted reports (and it more or less does this job very well). Sorry, but it’s definitely not made to be a RTF parser.

I recommend doing this with some other tool, for example, a VBA script in MS Access that imports the RTF and parses it using the MS Word API. Probably wouldn’t be that difficult.

Leave a Comment