RTF in clarion report does not show text

I am pretty sure you are not going to get what you want with RTF on a Clarion report.

Bad RTF on reports is why Solid Software created their “RichReport” addon. But even it does not support images on the RTF. Maybe @LANSRAD can confirm.

You might be more successful if you just render the RTF to an image when you save it on the window, then use that rendered image on the report.

I wonder if you have tried to save the RTF from the Clarion window procedure (where apparently it displays correctly?) to a file and then re-import the rft from the file back into your Clarion file field before you generate the report.

The hope here is that the Clarion "save to file " function will convert it to a Windows compatible format that your report will be able to use?

JAT

Hello, good evening!
Yes, my client has done this dozens of times, he has switched to MS Word, NotePad, MS Excel and nothing.
Apparently these programs understand the code and maintain it.
The Clarion screen’s RTF text controller also understands and maintains it, the problem is only in the report.
Thank you very much for your suggestion!

Happy to make suggestions!

I still wonder if doing it in Clarion will solve the problem? :wink:

Is it possible to upload a rtf example that demonstrates the problem?

Because those are not the same code.

Now we’ve cleared that up, you can stop worrying about that, and start working on converting the RTF to a format the report control can use.

Hi Bruce, I understand, but there are hundreds of clients who copy texts or parts of them and paste them into the system window.
The clients don’t understand code, so I need something that works like RTF, that is, that allows bold, italics, colors…
In my limited experience, I don’t really know what the coding would be for this, that is compatible with Clarion’s text controllers.
Thank you very much for the information.

Hello, yes above I posted two examples, one generated by Clarion’s RTF and the other copied from an external text.

Hello again Jorge

what I suggest you do is compare the “good” rtf with the “dud” one that doesn’t print.

make ONE transformation at a time to the dud pasted rtf that doesn’t print, and after each change try printing it.

do this until you find the combination of changes you need to do to make it work.

for example, in your examples above you can see the version that worked had a color table. If you add that to the dud version, does it then print?

once you have worked out what transformations you need you are then in a position to automate that. (In other words you effectively have a “spec”).

I previously mentioned StringTheory for the transformations because it makes things much easier (and it is what I always use), but you could do it using SystemStringClass or just using Clarion commands like “instring” for searching.

This is what Bruce is talking about when he says:

start working on converting the RTF to a format the report control can use.

hth and cheers

Geoff R

Experience is just something you’ve done before. And there’s a first time for everything. The only way to cure inexperience is by doing.

So I recommend doing what Geoff suggests - work through the RTF format and construct the RTF so the report RTF control is happy with it.

Once you are done doing this, and have one that works, then your experience in this regard will no longer be limited.

You are correct Jeff.

From our website:

What RichReport is NOT:

It is NOT a full-blown word-processor which supports all of the countless of features of RTF.

For example, images and tables are NOT supported. Instead, it was primarily designed to cover all the formatting elements introduced with the Clarion RTF control to give you the possibility to simply print RTF text.

Ok, thank you very much to everyone, I now understand what the path will be.
Hugs…!

Thanks for your attention Bruce!

I’ll try.
Thanks for your attention Geoff R
hth and cheers

Hi Jorge

After a bit of mucking around I think I have a solution for this.

The problem occurs where you have “Combining Diacritical Marks” in the text - these cause the problems when reporting.

see: Unicode Block “Combining Diacritical Marks”

There is more than one way to represent these characters - so the “trick” is to process your rtf text when saving to file (or some other time before printing) to translate these codes to something the print engine can handle.

I have done this using StringTheory based on your example rtf’s. I am translating the codes you have used (and some others) and stripping out the other modifiers that have not been translated. Those characters that are not translated will appear without the various accents. You can always add extra translations if you find you need them.

st StringTheory
x  long,Auto
y  long,Auto

  code
      st.setValue(clip(xxx:Description))  ! change to your field name
      st.replace('{{*\generator','{{\*\generator') 
      
      if st.findChars('\u769?')              ! https://www.compart.com/en/unicode/U+0301
        st.replace('A\u769?','\''c1')
        st.replace('E\u769?','\''c9')
        st.replace('I\u769?','\''cd')
        st.replace('O\u769?','\''d3')
        st.replace('U\u769?','\''da')
        st.replace('Y\u769?','\''dd')
        st.replace('a\u769?','\''e1')
        st.replace('e\u769?','\''e9')
        st.replace('i\u769?','\''ed')
        st.replace('o\u769?','\''f3')
        st.replace('u\u769?','\''fa')
        st.replace('y\u769?','\''fd')
      end
      
      if st.findChars('\u770?')                ! https://www.compart.com/en/unicode/U+0302
        st.replace('A\u770?','\''c2')
        st.replace('E\u770?','\''ca')
        st.replace('I\u770?','\''ce')
        st.replace('O\u770?','\''d4')
        st.replace('U\u770?','\''db')
        st.replace('a\u770?','\''e2')
        st.replace('e\u770?','\''ea')
        st.replace('i\u770?','\''ee')
        st.replace('o\u770?','\''f4')
        st.replace('u\u770?','\''fb')
      end
      
      if st.findChars('\u771?')                ! https://www.compart.com/en/unicode/U+0303
        st.replace('A\u771?','\''c3')
        st.replace('N\u771?','\''d1')
        st.replace('O\u771?','\''d5')
        st.replace('a\u771?','\''e3')
        st.replace('n\u771?','\''f1')
        st.replace('o\u771?','\''f5')
      end
      
      if st.findChars('\u807?')                ! https://www.compart.com/en/unicode/U+0327
        st.replace('C\u807?','\''c3')
        st.replace('c\u807?','\''e7')
      end
      
      ! remove/strip untranslated unicode modifiers  \uNNN?
      x = 1
      loop
        x = st.findChars('\u',x)
        if ~x then break.
        y = st.findChar('?',x+2)
        if ~y then break.
        if y <= x+6 and numeric(st.slice(x+2,y-1))
          st.RemoveFromPosition(x,y-x+1)
        else
          x += 2
        end
      end 
      
      xxx:Description = st.getValue()  ! update rtf field (change to use your field name)

anyway I hope that helps

cheers

Geoff R

#edit1. A couple of notes: Where I used

st.setValue(clip(xxx:Description))  ! change to your field name

I did it that way as I was loading from a memo field. If loading from a string field you are better to use:

st.setValue(myString, st:clip)  ! change to your field name

or perhaps you use st.LoadFile() if you are loading the rtf from a text file, then do the transformations then st.saveFile()

1 Like

Nice work Geoff,

I had a play with Jorge’s sample RTF and it crashed the app when printing the report.

If I get the time I’ll try your code.

Regards,

Geoff B

1 Like

That’s strange. In my case it didn’t crash but did show some gibberish similar to Jorge’s screen shots with the question marks in square boxes etc.

But it all displayed fine on the report once I transformed the rtf.

I was just using the RTF example program “rtfnotepad” that ships with Clarion. It is a bit clunky/buggy and does extra stuff like “mail merge” that is not relevant here but was sufficient for testing.