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

Page break

edited September 2006 in Devices
Hi all,
my report is entirely runtime generated.
In the detail band i put some DB aware controls as follows:

| | | | |
| tppMemo | TppDBText | TppDbText | TppDbtext |
| | | | |

i need to generate this at runtime, because i don't know the number of columns
to draw.
The ppMemo has the stretchable property set to true.
All the controls are included in a TppRegion because i need to "KeepToghether"
every line, especially when the memo stretches the band.
But sometimes the memo is rendered on the next page and the other dbtexts not...
this is the way i use to create control into the region... any help will be
greatly appreciated.

//rpt is an instance of TppCustomReport
detail := TppDetailBand(rpt.GetBand(btDetail, 0));
detail.PrintHeight := phDynamic;
reg := TppRegion.Create(MainDm);

with reg do begin
Band := detail;
ParentWidth := true;
ParentHeight := true;
StretchWithParent := true;
KeepTogether := true;
end;

[..cut..]

//set Region Property
with TppDBText.Create(MainDm) do begin
Region := reg;
//... other settings
end;

Gianantonio

Comments

  • edited September 2006

    - as a first step I would try created a similar layout using the designer
    and then once you get that working correctly, perform a view as text on the
    form or save the template to an ascii format .rtfm file and open it in the
    editor. Then you can review the property settings.

    - make sure that the Memo is inside the region as well as the DBText. Set
    Region.Stretch to True (not StretchWithParent). When you create the Memo and
    DBText, set the Region property, but not the Band property (when you set
    DBText.Region, the band property will be updated automatically to be the
    same band where the region is located).

    - do you create all of these layout elements prior to calling Report.Print?


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2006
    Nard Moseley (Digital Metaphors) wrote:
    Thank you Nard,
    good idea. I've changed the property. I forgot to tell you that the report is
    exported directly to a pdf device. The report is then streamed out to a byte
    array (Olevariant) for being downloaded from a web page. This is the code.

    MStr := TMemoryStream.Create();
    pdfdev := TppPDFDevice.Create(nil);

    WriteLog('setting up the device');
    with pdfdev do begin
    PDFSettings := MainDm.rpt.PDFSettings;
    OutputStream := MStr;
    Publisher := MainDm.rpt.Publisher;
    end;

    WriteLog('Let''s print into the stream');
    MainDm.rpt.PrintToDevices;
    //to olevariant
    result := convertToOleVariant(MStr);

    Now, with this property setted up the report works fine on my develop machine
    (WINXPPro in English) but not on the deployment server (WIN2003Server in
    English). I could send you those pdf generated on your private email
    Note that on the deployment server there are no printers installed.

    When you create the Memo and

    Yes that's true. i've already did it.
    yes of course.

    It's very difficult for me to send you a working example because i use a
    JITPipeline linked to several custom object. I can send you the whole code
    and the pdf generated if you need them to better understand.

    Thank you very much
    Gianantonio.
  • edited September 2006

    Rather than work on your real report, I recommend taking a step back and
    creating a very simple example. You can use the Delphi DBDemos data. First
    use the report designer to create a layout that contains a memo and dbText
    and then once you have that working, try to do the same using the code based
    approach. Then if you encounter an issue, you can easily email to
    support@digital-metaphors.com and we can review it.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.