Big problem with TRichView and cxGrid

General TRichView support forum. Please post your questions here
Post Reply
abranquart
Posts: 10
Joined: Thu Jul 05, 2012 1:00 pm

Big problem with TRichView and cxGrid

Post by abranquart »

I’m using TRichView inplace editors with cxGrid (Table and BandedTable views) version 2011 vol 2.4.

I have a big problem: All RichView cells are displaying the RTF as plain text !
When I click on one cell to edit it, the RTF is correctly displayed, but when I exit the editor the RTF is displayed again again as plain text.

PLEASE HELP ! Going on production on monday !

PS : RTF Plain text = -8 1 3 1 -7 0 -1 0 0 0 0 536870911 -9 2 0 0 2 0 1 Y ...

Thank you in advance !
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

As I can see, the edited content is saved as RVF (RichView Format). Then the component cannot load RVF, and it displays it as a plain text.
Probably, this database cannot contain binary data.
You can change saving format to RTF. For this editor, change Properties.EditValueSaveFormat = cxrvvfRTF
abranquart
Posts: 10
Joined: Thu Jul 05, 2012 1:00 pm

Post by abranquart »

Hi Sergey,
Thank you for you prompt reply.

The field is working fine with a TcxDBTRichViewEdit, but when I need to show/edit the same field in a cxGrid I'm getting this strange behavior ... when the field/cell is not in edit mode it displays the RVF as plan text, when the field/cell enter in edit mode (after clicking in the cell) everithing is fine ...

Please, take a look here :
http://screencast.com/t/Xeql4O8mv
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

There is a problem in TcxGrid, when a memo field is used.
When data are read from a database, they are passed to edited cell as AnsiString, to other cells as UnicodeString. TRichView can read RVF from AnsiString, but cannot from UnicodeString. Even a text-mode RVF can contain characters with codes > 127 (for example, non-text item properties are saved in UTF-8), so conversion of RVF from AnsiString to UnicodeString and back may lose information.

Solution: do not use memo fields for RVF format, use binary field.

PS I found my discussion with DevExpress developer about this issue (in December 2011): if a field type is ftMemo, in Delphi 2009+, field data are passed as UnicodeString to inplace editor, and as AnsiString to other cell. It happens for all inplace editor types, not only for TRichView (for example, for their memo fields). Probably, they forgot about this issue :(
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

For any case, try newer version of DX components, probably this question was solved somehow.
abranquart
Posts: 10
Joined: Thu Jul 05, 2012 1:00 pm

Post by abranquart »

Hi Sergey,
Unfortunately, I cannot use varbinary fields :-(
You think that if I use RTF format it will resolve the problem ?
Thank you.
abranquart
Posts: 10
Joined: Thu Jul 05, 2012 1:00 pm

Post by abranquart »

FYI : I'm not using SaveBinary option
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

RTF must help, because TRichView can read it both from WideString and AnsiString.
However, not all information can be saved in RTF. For example, label items will be saved as text.
Post Reply