Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Watermark - multi reports..

edited January 2016 in General
Hi All,

I have several reports on a form, and using following function:

function TForm1.CreateWaterMark: TppDrawCommand;
var
lWaterMark: TppDrawText;
llPageHeight: Longint;
llPageWidth: Longint;
liTextWidth: Integer;
liTextHeight: Integer;
lPrinter: TppPrinter;
begin

lWaterMark := TppDrawText.Create(nil);
lWaterMark.WrappedText.Add('ReportBuilder ' + ppEdition + #153 + ' -
Demo Copy');
lWaterMark.WrappedText.Add('Version ' + ppVersion);
lWaterMark.WrappedText.Add('Digital Metaphors Corporation');
lWaterMark.WrappedText.Add('Telephone: 303.531.8032');
lWaterMark.WrappedText.Add('E-Mail: sales@digital-metaphors.com');
lWaterMark.Transparent := True;
lWaterMark.IsMemo := False;
lWaterMark.WordWrap := True;
lWaterMark.Font.Name := 'Arial';
lWaterMark.Font.Size := 18;
lWaterMark.Font.Color := clBlack;
lWaterMark.Autosize := True;

liTextWidth := 375;
liTextHeight := 150;

lPrinter := ppReport1.Printer;

llPageHeight := lPrinter.PrinterSetup.PageDef.mmPrintableHeight;
llPageWidth := lPrinter.PrinterSetup.PageDef.mmPrintableWidth;
lWaterMark.Height := ppToMMThousandths(liTextHeight, utScreenPixels,
pprtHorizontal, nil);
lWaterMark.Width := ppToMMThousandths(liTextWidth, utScreenPixels,
pprtHorizontal, nil);

lWaterMark.Top := (llPageHeight - lWaterMark.Height) div 2;
lWaterMark.Left := (llPageWidth - lWaterMark.Width ) div 2;

Result := lWaterMark;

end;

How can I change this to support multiple reports calling the report
name inside?

Thanks in advance,

Regards,

Hüseyin A.

Comments

  • edited January 2016
    Hi Huseyin,

    One option is to add a TppReport parameter to the CreateWaterMark
    routine (or a TppPrinter parameter).

    function TForm1.CreateWaterMark(aReport: TppReport): TppDrawCommand;
    ...
    begin
    ...
    lPrinter := aReport.Printer;
    ...
    end;



    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2016
    Hi Nico,

    Thanks, work great :)

    Regards,
    Hüseyin A.

This discussion has been closed.