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

Report Components after generate

edited February 2015 in General
Hi @ all,

We use Delphi Xe2. We create a Report at runtime and then load the
template into the report.
Is there a way,for example, to get the width of a variable after the
Report was generated?

With this:
http://www.digital-metaphors.com:8080/Delphi_Code/Layouts/Report_Object_Loop

I only get the values before the report was generated.
For example a variable has a width of 26 before print.
Then after print the variable has a width of 210. How can i get the
value of 210?

Thanks.

Nick

Comments

  • edited February 2015
    Hi Nick,

    The easiest way is to create a local bitmap object and use its canvas to
    measure the text. For instance...

    procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
    var
    lBitmap: TBitmap;
    liTextWidth: Integer;
    begin

    Value := ppReport1.DataPipeline['Company'];

    lBitmap := TBitmap.Create;

    try
    liTextWidth := lBitmap.Canvas.TextWidth(Value);
    //Convert from Screen Pixels here using ppUtils.ppFromScreenPixels
    if needed.

    finally
    lBitmap.Free;

    end;

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2015
    Thank you for the answer.

    But the problem is, that our customers design their Reports with the
    ReportDesigner and we load the template at runtime and not at design
    time, so I dont have the access to this variable in delphi on designtime.

    Should I maybe send you an example project?

    Best Regards,
    Nick.


    Am 12.02.2015 16:40, schrieb Nico Cizik (Digital Metaphors):
This discussion has been closed.