Thanks for the example. I needed it to work in RAP, but I found an example named RAPDrawCommandFunctions, and I was able to do the same with TppDrawText.
I can't figure why the width is calculating just a bit short. For instance when the functions is called like this: AddDrawText(Report, '$39,149.40', DBCalc1.Font, 146350, 63499), the right most '40' is not printing. I would greatly appreciate if you could show me what I'm missing. (DBCalc1 is an Invisible component residing in the group footer).
BTW, I was thinking if there isn't any way of taking a component residing in the footer and change it's position to where I'm trying to create the ppDrawText , instead of recreating one.
TIA
-Jack
The signature is: 'function AddDrawText(Report: TppReport; aText: string; Font: TFont; nLeft, nTop: Integer): TppDrawText;';
procedure TcdAddDrawText.ExecuteFunction(aParams: TraParamList); var lReport: TppReport; lsText: string; liHeight, liLeft, liWidth, liTop: Integer; lDrawText: TppDrawText; lCanvas: TCanvas; lFont: TFont; begin
Comments
--
Guillermo Casta?o A.
www.GrupoMillennium.com
-Jack
data by creating draw commands that are inline with the last detail band of
a group. Here is an example:
http://www.digital-metaphors.com/tips/DrawGroupSumInLastDetail.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Thanks for the example. I needed it to work in RAP, but I found an example
named RAPDrawCommandFunctions, and I was able to do the same with
TppDrawText.
I can't figure why the width is calculating just a bit short. For instance
when the functions is called like this:
AddDrawText(Report, '$39,149.40', DBCalc1.Font, 146350, 63499), the right
most '40' is not printing. I would greatly appreciate if you could show me
what I'm missing. (DBCalc1 is an Invisible component residing in the group
footer).
BTW, I was thinking if there isn't any way of taking a component residing in
the footer and change it's position to where I'm trying to create the
ppDrawText , instead of recreating one.
TIA
-Jack
The signature is:
'function AddDrawText(Report: TppReport; aText: string; Font: TFont;
nLeft, nTop: Integer): TppDrawText;';
procedure TcdAddDrawText.ExecuteFunction(aParams: TraParamList);
var
lReport: TppReport;
lsText: string;
liHeight, liLeft, liWidth, liTop: Integer;
lDrawText: TppDrawText;
lCanvas: TCanvas;
lFont: TFont;
begin
GetParamValue(0, lReport);
GetParamValue(1, lsText);
GetParamValue(2, lFont);
GetParamValue(3, liLeft);
GetParamValue(4, liTop);
lDrawText := TppDrawText.Create(nil);
lDrawText.Page := lReport.Engine.Page;
lDrawText.Text := lsText;
lDrawText.Font := lFont;
lDrawText.Left := liLeft;
lCanvas := lReport.Printer.Canvas;
lCanvas.Font := lDrawText.Font;
liHeight := lCanvas.TextHeight(lDrawText.Text);
liHeight := ppToMMThousandths(liHeight, utPrinterPixels, pprtVertical,
lReport.Printer);
lDrawText.Height := liHeight;
lDrawText.Top := liTop - liHeight;
liWidth := lCanvas.TextWidth(lDrawText.Text);
liWidth := ppToMMThousandths(liWidth, utPrinterPixels, pprtHorizontal,
lReport.Printer);
lDrawText.Width := liWidth;
SetParamValue(1, lDrawText);
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com