I am using TRichview 19, Delphi XE3, Firebird 3 and Report builder 20.04
Please see the attached images. Any idea why this is happening?
Thanks,
Mike Simmons
Garbled rendering of TppDBRichview
-
- Posts: 29
- Joined: Mon Oct 25, 2010 3:59 pm
Garbled rendering of TppDBRichview
- Attachments
-
- During preview or report generation, the rendering becomes corrupted
- Preview-RuntimeFail.jpg (107.26 KiB) Viewed 17896 times
-
- With dataset active during design the RVF text looks good.
- Desgn-OK.jpg (238.12 KiB) Viewed 17896 times
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Garbled rendering of TppDBRichview
Can you create a simple project where I can reproduce the problem?
-
- Posts: 29
- Joined: Mon Oct 25, 2010 3:59 pm
Re: Garbled rendering of TppDBRichview
I've attached a zipped sample project which includes a small Firebird 3 DB. This is a Delphi 10.4 project using Firebird 3 and ReportBuilder 20.04.
When you open up the project you will need to adjust the Database location in FDConnection1.
You may need to adjust the VendorLib property in FDPhysFBDriverLink1
To test;
1. Set FDConnection1 to Connected
2. Set FDQuery1 to Active
3. Double click ppReport1 to bring up the designer. From there, switch between the Design and Preview windows to see the issue.
Thanks,
Mike
When you open up the project you will need to adjust the Database location in FDConnection1.
You may need to adjust the VendorLib property in FDPhysFBDriverLink1
To test;
1. Set FDConnection1 to Connected
2. Set FDQuery1 to Active
3. Double click ppReport1 to bring up the designer. From there, switch between the Design and Preview windows to see the issue.
Thanks,
Mike
- Attachments
-
- RVFDEMO.zip
- (104.06 KiB) Downloaded 1106 times
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Garbled rendering of TppDBRichview
This text has font size = 0. When this font is applied to a canvas, results may be different.
(
I have a guess why this font size may appear.
A very old code of ActionTest demo used rvActionFontEx.Font.Size to implement a font size combobox.
In newer version of RichViewActions, rvActionFontEx.Font.Size must not be used, rvActionFontEx.FontSizeDouble must be used instead. Also, a font size combobox now works automatically, but some users continued to use that code fragment, resulting zero font size in documents.
In the newest version of RichViewActions, both rvActionFontEx.Font.Size and rvActionFontEx.FontSizeDouble can be used, but this fix came too late.
)
I can suggest a workaround for such documents.
Open RVStyle.pas, find procedure TCustomRVFontInfo.Apply.
At the beginning of this procedure, add
So 10pt will be used instead of zero font size.
(
I have a guess why this font size may appear.
A very old code of ActionTest demo used rvActionFontEx.Font.Size to implement a font size combobox.
In newer version of RichViewActions, rvActionFontEx.Font.Size must not be used, rvActionFontEx.FontSizeDouble must be used instead. Also, a font size combobox now works automatically, but some users continued to use that code fragment, resulting zero font size in documents.
In the newest version of RichViewActions, both rvActionFontEx.Font.Size and rvActionFontEx.FontSizeDouble can be used, but this fix came too late.
)
I can suggest a workaround for such documents.
Open RVStyle.pas, find procedure TCustomRVFontInfo.Apply.
At the beginning of this procedure, add
Code: Select all
if SizeDouble <= 0 then
SizeDouble := 20;
-
- Posts: 29
- Joined: Mon Oct 25, 2010 3:59 pm
Re: Garbled rendering of TppDBRichview
The code changes you suggested did fix the error. Thanks!
The font size combobox (first created many years ago) does not even use actions. Here is the code just so you know what was used.
procedure TElementEditor.cmbFontSizeChange(Sender: TObject);
begin
if RVE = nil
then Exit;
if UpdatingCombos then
exit;
try
FontSize := StrToInt(cmbFontSize.Text);
with rvActionFontEx1 do begin
UserInterface := False;
ValidProperties := [rvfimSize];
Font.Size := FontSize;
Execute;
UserInterface := True;
end;
except
Beep;
end;
RVE.SetFocus;
end;
I will spend some time to convert over to use the latest actions.
Is there a way I could load each BLOB field, locate any text having a 0 size font, and then adjust to a non-zero size and re-save. Is there any sample code of how this mighty be done?
The font size combobox (first created many years ago) does not even use actions. Here is the code just so you know what was used.
procedure TElementEditor.cmbFontSizeChange(Sender: TObject);
begin
if RVE = nil
then Exit;
if UpdatingCombos then
exit;
try
FontSize := StrToInt(cmbFontSize.Text);
with rvActionFontEx1 do begin
UserInterface := False;
ValidProperties := [rvfimSize];
Font.Size := FontSize;
Execute;
UserInterface := True;
end;
except
Beep;
end;
RVE.SetFocus;
end;
I will spend some time to convert over to use the latest actions.
Is there a way I could load each BLOB field, locate any text having a 0 size font, and then adjust to a non-zero size and re-save. Is there any sample code of how this mighty be done?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Garbled rendering of TppDBRichview
In the new version of RichViewActions, this event can be removed.
Use TRVFontSizeComboBox.
Assign its properties:
RVFontSizeComboBox1.ActionFont = rvActionFontEx1;
RVFontSizeComboBox1.Editor = RichViewEdit;
And it will do all the work automatically.
The same is for font names, use TRVFontComboBox without assigning events.
As for adjusting all font sizes after loading.
Let you have DBRichViewEdit1: TDBRichViewEdit linked to a dataset Table1 (of TFDQuery or TFDTable type).
Use the code like this.
Use TRVFontSizeComboBox.
Assign its properties:
RVFontSizeComboBox1.ActionFont = rvActionFontEx1;
RVFontSizeComboBox1.Editor = RichViewEdit;
And it will do all the work automatically.
The same is for font names, use TRVFontComboBox without assigning events.
As for adjusting all font sizes after loading.
Let you have DBRichViewEdit1: TDBRichViewEdit linked to a dataset Table1 (of TFDQuery or TFDTable type).
Use the code like this.
Code: Select all
Table1.First;
while not Table1.Eof do
begin
if DBRichViewEdit1.CanChange then
begin
for i := 0 to DBRichViewEdit1.Style.TextStyles.Count - 1 do
if DBRichViewEdit1.Style.TextStyles[i].Size = 0 then
DBRichViewEdit1.Style.TextStyles[i].Size = 10;
DBRichViewEdit1.Change;
Table1.Post;
end;
Table1.Next;
end;
-
- Posts: 29
- Joined: Mon Oct 25, 2010 3:59 pm
Re: Garbled rendering of TppDBRichview
Thank you Sergey!