Page 1 of 1

Problem with DBRichViewEdit and Textstyle

Posted: Fri Mar 16, 2018 1:19 pm
by Bjoern
I have a strange problem with DBRichViewEdit and styles.
On a DBCtrlGrid there is a DBRichViewEdit, two DBRichViewEdits are visible (Rowcount 2 in DBCtrlGrid)
In record 1 the text is default
In record 2, the text is
1 line smaller (with rvActionFontShrinkOnePoint)
2 line larger (with rvActionFontGrowOnePoint)
3 line red (with rvActionFontColor)

So far everything works, the formatted text is displayed correctly in DBRichViewEdit.

When I quit and restart the program, everything is also displayed correctly in both DBRichViewEdits.

But if I have a

Code: Select all

MyTable.DisableControls;
MyTable.First;
For i := 1 to MyTable RecordCount do
Begin
	Save as HTML
End;
then the formatting is not present in the saved text.

If I enter the second (formatted) record once in the form, then it works.

With a test

Code: Select all

DummyStr :='';
for i := 0 to MyDBRichViewEdit.Style.TextStyles.Count - 1 do
begin
	DummyStr := DummyStr + IntToStr(i)+':size:'+IntToStr(MyDBRichViewEdit.Style.TextStyles[i].Size)+'/color:'
	+RV_GetHTMLRGBStr(MyDBRichViewEdit.style.TextStyles[i].Color,False)+ '#13+#10';
end;
ShowMessage((DummyStr));
I see that if I just start the program (the focus is in the first record) I only get the default styles used in the first record.
But if I go to the second record and then test, I get more styles and the correct styles are displayed.
If I go to the second record and back to the first record it works too.

It seems to me that the style information is only complete once all records have been the active record.

Maybe anybody have any idea how to solve this?
I can't go programatically to all records in all tables before saving them without DisableControls.


Additional data:
Trichview 13.0.5, Text stored as RTF
Delphi 5
Advantage Database Server 10.10.0.28 with TAdsTable
DBRichViewEdit has his own TRStyle

Update after some further testing:
If i insert

Code: Select all

MyTable.First;
while not MyTable.Eof do
begin
	MyTable.Next;
end;
MyTable.First;
before the test, it works fine.

But if i use (to avoid the "screen-action")

Code: Select all

MyTable.DisableControls;
MyTable.First;
while not MyTable.Eof do
begin
	MyTable.Next;
end;
MyTable.First;
MyTable.EnableControls;
i only get the default styles from the first record :-(

Greetings
Björn

Re: Problem with DBRichViewEdit and Textstyle

Posted: Wed Apr 04, 2018 10:45 am
by Sergey Tkachenko
I am sorry for overlooking this question.

Make sure that each DBRichViewEdit is linked to its own TRVStyle component.
And make sure that they all have RTFProperties.TextStyleMode = RTFProperties.ParaStyleMode = rvrsAddIfNeeded.