Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crystal Reports messing up Rich Text

I have a string that gets saved as rich text to a SQL field, so it has a lot of symbols in front of it like so...

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Verdana;}} {\colortbl ;\red0\green0\blue255;} \viewkind4\uc1\pard\sa200\sl276\slmult1\f0\fs22 Blah Blah Blah \par

I'm passing in this to Crystal Reports 11.5 as a parameter field, so the data type is string. I'm then just displaying it straight up by dragging the parameter to the report. The interpretation is set to RTF also in the paragraph tab of the formatting settings for this.

My problem is, it is removing the formatting tags but it is screwing up the text. It is randomly garbling words and inserting characters like the letter 'i' randomly in words, it's also putting some random letters in the background behind other words, making it look like it's been typed over manually if that makes sense, just makes the word look unreadable and bolded like someone typed over it with a typewriter.

I tried setting a new text object and then putting the rich text parameter in that to display, but then it doesn't remove/do any of the rich text formatting tags.

What gives? It can obviously do rich text as it removes the tags, but what is the deal with the random i's inserted into words and a couple of instances of the jumbled text over other words?

like image 667
Nard Dog Avatar asked Nov 13 '22 19:11

Nard Dog


1 Answers

Unfortunately, I haven't used 11.5 yet.. but give this a try..

Format Field > Paragraph tab > Text Interpretation > RTF text

If the text is getting overlapped, then you can replace the following control set from your RTF text. It should work properly and not overlap.

data = data.Replace(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Verdana;}} {\colortbl ;\red0\green0\blue255;} \viewkind4\uc1\pard\sa200\sl276\slmult1\f0\fs22 Blah Blah Blah \par", string.Empty);
like image 124
MacGyver Avatar answered Dec 17 '22 14:12

MacGyver