Text or Richtext or something between?
Hi!
Now I have an application which stores plaintext. When printing an
offer our customers want to have some formating features like Bold,
underline, Tabs and so on. This is not possible with text and when I
use richtext this formatting is ok, but then the richtext is also
printed with the font which is defined in the richtext and I am not
able to change the font with the reportbuilder or in other words I
don't see any way to make this.
So it would be perfect to have a Edit which is able to make such
formattings without font and this should be also printable with
Reportbuilder. Does anybody know about such thing? Thank you.
Gruß aus den Bergen
Günter
Now I have an application which stores plaintext. When printing an
offer our customers want to have some formating features like Bold,
underline, Tabs and so on. This is not possible with text and when I
use richtext this formatting is ok, but then the richtext is also
printed with the font which is defined in the richtext and I am not
able to change the font with the reportbuilder or in other words I
don't see any way to make this.
So it would be perfect to have a Edit which is able to make such
formattings without font and this should be also printable with
Reportbuilder. Does anybody know about such thing? Thank you.
Gruß aus den Bergen
Günter
This discussion has been closed.
Comments
You can use the TppRichText.SelAttributes property to change the font of the
richtext text at runtime. Take a look at the
TppCustomRichText.SelAttributes topic in the RBuilder help for more
infomation. Also see TTextAttributes in the Delphi help.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I can't get this property via RAP. So I made a Function like this:
-------------------
procedure TmgmRichtextFont.ExecuteFunction(aParams: TraParamList);
var
oRTF : TppCustomRichText;
oLike : TppLabel;
bFlag : Boolean;
begin
bFlag := True;
GetParamValue(0, oRTF);
GetParamValue(1, oLike);
if oRTF.SelLength = 0
then oRTF.SelectAll;
oRTF.SelAttributes.Name := oLike.Font.Name;
oRTF.SelAttributes.Size := oLike.Font.Size;
oRTF.SelAttributes.Style := oLike.Font.Style;
oRTF.SelAttributes.Color := oLike.Font.Color;
SetParamValue(2, bFlag);
end;
class function TmgmRichtextFont.GetSignature: String;
begin
Result := 'Function SetRichTextFont(RTF : TppCustomRichText; FontObject :
TppLabel) : Boolean;';
end;
-------------------
It seams to work but when I have the TppDBRichText on a Detail, it only works
on the last Detail with TppDBRichtext which is printed. On all other Details
the font is unchanged. When I move the db-value manuell to a TppRichtext it is
working (I am using rap in the Detail.beforePring):
SetRichTextFont(ppDBRichtext1, Label1); -> Only working on the last detail
ppRichtext1.RichText := db['Rtfvalue'];
SetRichTextFont(ppRichText1, Label1); -> Always working but not easy for
customers
Maybe you have a small example how to make this correctly? Thank you.
Gruß aus den Bergen
Günter
Which version of ReportBuilder are you using? In my testing with RB 10.06 I
was able to successfully change the font of a DBRichText in every
Detailband.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
It is 10.05 with Delphi 7. Maybe you can show me what you did in RAP and in
which event? Thanks.
Gruß aus den Bergen
Günter
Below is the exact pass-thru function I am using. I placed the call inside
the DetailBand.BeforePrint event.
procedure TmyRichTextFunction.ExecuteFunction(aParams: TraParamList);
var
lRichText: TppCustomRichText;
lFont: TFont;
begin
GetParamValue(0, lRichText);
GetParamValue(1, lFont);
lRichText.SelectAll;
lRichText.SelAttributes.Name := lFont.Name;
lRichText.SelAttributes.Style := lFont.Style;
lRichText.SelAttributes.Color := lFont.Color;
lRichText.SelAttributes.Size := lFont.Size;
end;
class function TmyRichTextFunction.GetSignature: String;
begin
Result := 'procedure ChangeRTFFont(aRTF: TppCustomRichText; aFont:
TFont);';
end;
class function TmyRichTextFunction.IsFunction: Boolean;
begin
Result := False;
end;
initialization
raRegisterFunction('ChangeRTFFont', TmyRichTextFunction);
finalization
raUnRegisterFunction('ChangeRTFFont');
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com