SaveFormat with TwwDBRichEdit

256 views
Skip to first unread message

Luis

unread,
Sep 2, 2013, 10:19:46 AM9/2/13
to woll2woll...@googlegroups.com
We are busy migrating projects from Delphi 5 to Delphi XE3 and we several forms that make use of your TwwDBRichEdit component. We notice that the component now has a SaveFormat which is defaulted to 'wwrsfRTF'. If we leave the SaveFormat property with this default value (wwrsfRTF) and update the value in the text, the text appears for example like this:
 
 {\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Tahoma;}} \viewkind4\uc1\pard\lan instead of Hello World.
 
Please clarify what we should do? Should we change all the default settings from wwrsfRTF to wwrsfPlainText?
 
Thank you and kind regards, Luis Coelho

Roy Woll

unread,
Sep 2, 2013, 2:51:30 PM9/2/13
to woll2woll...@googlegroups.com

Please provide more information about your setup, as I do not see your problem occur in our demos.  Are you bound to a database field?  If so, then what kind of field are you bound to, (i.e. blobfield, stringfield, etc.).  I just need to be able to reproduce your problem, as I am not able to right now.

Also, are you trying to save formatting (boldface, etc.) into the control, or are you just tryng to do plaintext editing?

From Delphi 5 to XE3, your projects are also transiitioning from non-unicode to unicode.so this could also be playing a role.

You should not be using wwrsfPlainText or wwrsfPlainTextUnicode unless you don't want the formatting stored.

-Roy

Luis

unread,
Sep 3, 2013, 12:19:42 AM9/3/13
to woll2woll...@googlegroups.com

1. In SQL Server 2012, create a test table called _TestTable and a field 'Notes' of type Char(80) or NChar(80) (The problem happens with both)
2. In Delphi XE3, create a test application and on a new form, place a TADOConnection, TADOTable, TDataSource and TDBNavigator component
3. Setup the data controls so that the table is linked to the _TestTable and the datasource is linked to the table
4. Set the TDBNavigator's DataSource to the datasource
4. Place a TwwDBRichText component on the form and link it to the datasource and set it's DataField property to the Notes field.
5. Set the TADOTable's Active field to True
6. Run application, insert a new record and, in the wwDBRichText, enter text like 'Hello World'
7. When you update the record, you will see the result (see my screenshots of before and after update)

As mentioned, we have projects that were in Delphi 5 that used the wwDBRichText and that have been migrated to Delphi XE3 that are now giving this result.

Before.png
After.png

Luis

unread,
Sep 4, 2013, 11:52:19 PM9/4/13
to woll2woll...@googlegroups.com
Hi Roy, I just want to confirm whether the test example I sent you has been helpful to check this problem we're experiencing?

Thank you and kind regards.

Roy Woll

unread,
Sep 5, 2013, 12:11:12 AM9/5/13
to woll2woll...@googlegroups.com
Sorry I forgot to reply. There were questions and comments that I don't see a reply to that I asked.
 
1. Also, are you trying to save formatting (boldface, etc.) into the control, or are you just tryng to do plaintext editing?
 
2. From Delphi 5 to XE3, your projects are also transiitioning from non-unicode to unicode.so this could also be playing a role.
3. You should not be using wwrsfPlainText or wwrsfPlainTextUnicode unless you don't want the formatting stored.
 
You did provide the SQL Server setup, but what I need to know is what does Delphi see your database field is.  Dbl-click the dataset at design time, and tell me if the field is a TBlobField or a TMemoField, not a fixed character string field.
 
-Roy
 

Luis

unread,
Sep 6, 2013, 1:14:13 AM9/6/13
to woll2woll...@googlegroups.com
Hi Roy,

Thanks for your kind assistance. Did you manage to reproduce the problem with the information I sent you? To answer your questions:

1. The case at hand does not need saving in blodface, etc. it was just being used to save plaintext.
2. The example I sent you has the Notes field defined as NChar which is Unicode and the problem still occurs. I also changed the field type to NVarChar and the same thing happens.
3. The issue is that when you migrate from Delphi 5 to Delphi XE3, the default SaveFormat property set is 'wwrsfRTF'. As the example I sent shows, with the property set to wwrsfRTF, when you Update the TwwDBRichEdit, the results are what I showed. i.e.  {\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Tahoma;}} \viewkind4\uc1\pard\lan instead of the normal text entered.

You ask whether Delphi sees my database field as TBlobField or TMemoField. I don't think it does. When I select the Query and the field 'Notes' it shows it as a string field. How can I make Delphi change it to a Blob/memo even though it is linked to a NVarChar in the database? 

What I want to know is that in Delphi 5 this wasn't an issue. You could place a TwwDBRichEdit component and link it to a string field and it would work fine with the default settings of the component. Has this now changed?

Thank you for your kind assistance.

Roy Woll

unread,
Sep 9, 2013, 6:44:46 PM9/9/13
to woll2woll...@googlegroups.com
I'm actually surprised it worked in Delphi 5, since the richedit is designed to work with a TBlobField. We only recently added the ability to use strings instead of blobs  Even in those cases, you would need to make sure that your string field is sufficiently large as rtf strings take up a lot more space than plaintext.

Delphi 5 only supported non-unicode strings so its possible it worked in some cases, although the design did not intentionally support this at that time.

Since you do not wish to store formatting, you would need to set the SaveFormat to plaintext.

-Roy

Luis

unread,
Sep 10, 2013, 12:00:12 AM9/10/13
to woll2woll...@googlegroups.com
Hi Roy, 

Thanks for looking into that and clarifying. We will make the appropriate adjustments you mention.

Kind regards, Luis
Reply all
Reply to author
Forward
0 new messages