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

How to copy a DetailBand to another report?

edited December 2003 in General
Hi all,

using RB 6.02

Is there an easy way to copy a DetailBand from one report to another?
If not, how should I copy all objects from one band to the other?

Thx. i.a.
Ben
--

Please post your reply's only in this newsgroup. Do not cross-post.

Ben Pottiez
PeopleWare

Ben_Pottiez{noSPAM!@}PeopleWare.be
(do not send me e-mail, unless specifically asked for)

http://www.PeopleWare.be
http://www.MobileWare.be

info{noSPAM!@}PeopleWare.be

It's amazing what one can accomplish
when one doesn't know
what one can't do... (Garfield)

Comments

  • edited December 2003
    Hi Ben,

    You shoulde be able to simply copy-paste (ie. ctrl-c, ctrl-v) all objects
    from one band to another without problem although sometimes the spacing may
    not be the same from one report to another. It would be a good idea to take
    note of the print position of each object so they can be placed in a similar
    location on the next report. You may also want to try saving your Report
    Template as ASCI text and simply copy-pasteing the detail band template
    instructions from one template to another.

    --
    Best Regards,

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

    Sorry, maybe my question wasn't all to detailed, but I mean in code
    (delphi).

    I have a report where I give the end-user the possibility to create part of
    a document themself using the report designer. Then I need to copy that part
    of the report on to a band in my actual report.

    This question is related to a previous question I posted on december 1st:
    "Semi dynamic-report generation".

    --

    Please post your reply's only in this newsgroup. Do not cross-post.

    Ben Pottiez
    PeopleWare

    Ben_Pottiez{noSPAM!@}PeopleWare.be
    (do not send me e-mail, unless specifically asked for)

    http://www.PeopleWare.be
    http://www.MobileWare.be

    info{noSPAM!@}PeopleWare.be

    It's amazing what one can accomplish
    when one doesn't know
    what one can't do... (Garfield)
  • edited December 2003
    You could just change the .Band property assignments of the controls or you
    may
    need to do something like this:


    procedure CopyBandObjects;
    var
    iBandNo : Integer;
    iObjectNo : Integer;
    rbLabel : TppLabel;
    rbDBText : TppDBText;
    begin
    for iBandNo := 0 to Report.BandCount - 1 do
    begin
    if (Report.Bands[iBandNo] is TppDetailBand) then
    begin
    for iObjectNo := 0 to Report.Bands[iBandNo].ObjectCount - 1 do
    begin
    if Report.Bands[iBandNo].Objects[iObjectNo] is TppLabel then
    begin
    with (Report.Bands[iBandNo].Objects[iObjectNo] as TppLabel) do
    begin
    rbLabel := TppLabel.Create(nil);
    rbLabel.AutoSize := AutoSize;
    rbLabel.Alignment := Alignment;
    rbLabel.Font := Font;
    rbLabel.Top := mmTop;
    rbLabel.Left := mmLeft;
    rbLabel.Height := mmHeight;
    rbLabel.Width := mmWidth;
    rbLabel.Transparent := Transparent;
    rbLabel.Text := Text;
    rbLabel.Band := NewBand; //the new band
    end;
    end
    else
    if Report.Bands[iBandNo].Objects[iObjectNo] is TppDBText then
    begin
    with (Report.Bands[iBandNo].Objects[iObjectNo] as TppDBText) do
    begin
    rbDBText := TppDBText.Create(nil);
    rbDBText.AutoSize := AutoSize;
    rbDBText.Alignment := Alignment;
    rbDBText.Font := Font;
    ...
    ...
    rbDBText.Band := NewBand; //the new band
    end;
    end;
    end;
    end;
    end;
    end;

    HTH,
    Chuck Van Acker
    Alogent Corp.
  • edited December 2003
    Hi Ben,

    Sorry, I did not understand your question. Chuck is correct, using a report
    object loop to copy the components from one band to another would be the
    best way to go about it. Thanks Chuck.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.