Dataset.Post clears formatting/unicode from TDBRichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
stuartclennett
Posts: 13
Joined: Wed Oct 22, 2014 9:37 am
Location: UK

Dataset.Post clears formatting/unicode from TDBRichViewEdit

Post by stuartclennett »

Hi,

(Please bear with me, I am new to the TRichView components)

I have a blob field in a SQL Server database that I've hooked up a TDBRichViewEdit component (via FireDAC & RemObjects DataAbstract)

If I paste in unicode characters they're showing fine until I call dataset.post (via a Save button) and then the unicode characters change to ????

If I make any formatting changes (bold, Heading style) etc, they are all lost when Post is called.

There are no beforePost/afterPost events on the dataset.

I've replaced the TDBRichViewEdit component with another one straight off the component palette (i.e. to ensure that I haven't switched any properties), and it still does the same thing.

The formatting functions (styles, font name and font size) are all lifted straight from your REditor demo.

Note, this _was_ working earlier, but I don't know what I've done wrong?

Do you have any suggestions please?

Thanks,
Stuart

Delphi XE6
RichView 15.1.2
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you right click the editor in Delphi, choose Options, what do you see:
- allow adding styles dynamically
- use a predefined set of styles?

(this option may be applied to new editors placed on a form, if you checked "default" when applied it last time)
stuartclennett
Posts: 13
Joined: Wed Oct 22, 2014 9:37 am
Location: UK

Post by stuartclennett »

Thanks for your reply Sergey.

Right click on component > Settings...

I have "Allow adding styles dynamically" ticked.

Here's a screen grab of all three settings pages:

http://imgur.com/4wUzcrg


Thanks
Stuart
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Is this DBRichViewEdit linked to its own TRVStyle, or may be itshares TRVStyle with another TRichView?
stuartclennett
Posts: 13
Joined: Wed Oct 22, 2014 9:37 am
Location: UK

Post by stuartclennett »

Hi,

No it has it's own RVStyle component.

I just put together a test app (connected to the same DB server) and the TDBRichViewEdit behaves as expected.

So I copied and pasted the RVStyle & DBRichViewEdit components from the test app to the 'real' app, and the problem still persists.

I am really stuck with this, don't know what I am doing in the 'real' application to make it behave like this. :(

I have made a short gif to show what happens in my app:

http://imgur.com/mxnTYev


Thanks for your continued assistance,

Stuart
stuartclennett
Posts: 13
Joined: Wed Oct 22, 2014 9:37 am
Location: UK

Post by stuartclennett »

I think this might be significant:

I wanted to see the 'raw' contents of the field behind the TDBRichViewEdit, so I added a TDBMemo component on the same form.

The TDBMemo shows the text from the DBRichViewEdit, but (obviously) in plain text, even though rvfoSaveBinary is flagged on the DBRichViewEdit control and fieldformat = rvdbRVF.

The underlying field is a blob field - SQL Server type "varbinary(max)".

Does this help ?

Thanks
Stuart
stuartclennett
Posts: 13
Joined: Wed Oct 22, 2014 9:37 am
Location: UK

Post by stuartclennett »

Here's another gif that shows the DBRichViewEdit and a DBMemo attached to the same field.

At the start, the contents are obviously binary (edited in my test app)

When I edit the DBRichViewEdit nothing happens until I try to bold some text - then the RAW field contents change to plain text.

Then hitting Save (i.e. Dataset.Post) converts the DBRichViewEdit to plain text as well.

http://i.imgur.com/9tPYLDe.gif

Thanks
Stuart
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

According to your first screenshot, field saving format is RTF, not RVF.
But it's strange that you can see a plain text.

May be you have OnSaveCustomFormat event processed?
stuartclennett
Posts: 13
Joined: Wed Oct 22, 2014 9:37 am
Location: UK

Post by stuartclennett »

Hi Sergey,

I didn't have OnSaveCustomFormat event assigned.

However, your comment got me to question the FieldFormat property and I then found that my code was setting the FieldFormat to 'Text' during the formcreate event. (the record in the database can be either rich text or plain text and my IF statement was wrong.

Phew.

Many many thanks for your help -- great support & I apologise for making such a newbie mistake.

Stuart
Post Reply