Home RAP

Fill with lines between a header group and a footer group - RB7.01 D6.2 EndUser with RAP

edited February 2003 in RAP
I have a report with a Header group that scans a child table. The
corresponding footer (non scanning) is set to a print position of 9
inches.

I want to fill the white space between the bottom of the header and
the top of the footer with lines.

What is the best way to do this using RAP?

I had thought of adding a subreport with just one line and setting in
RAP the Bands per Record but I am unsure of the syntax (and event) for
calculating how many lines I want. (or perhaps it is not the best
approach?)

Thanks,
Rick Matthews
Dartek Systems Inc.

Comments

  • edited February 2003
    Since you manually set the footer's print position, you can use the
    PageStyle band to print lines behind it in that space. The PageStyle band
    prints behind all other bands on the page. This would require no RAP code.

    Alternatively, you could also try using a subreport and set bands per record
    to N, although I believe that you would have to hook the subreport up to a
    dummy one record JIT pipeline to get it to print a single record N times, as
    it should check to see if there are records in the pipeline in that case.
    I'd have to try it to be sure.

    If that doesn't work, then you could create lines using DrawCommands via a
    RAP pass through function. Here is an example of creating draw commands on
    the page to fill space from the last detail to the bottom of the page:
    http://www.digital-metaphors.com/tips/FillPageWithLines.zip

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2003
    Thanks Jim for the suggestions:

    1) Pagestyle is appealing but I can only have the lines where other
    bands have not printed (even if it is white space). In my test the
    lines show up as a background. I guess it would need a
    "non-transparent" setting for the other bands?

    2) I did try a subreport with no pipeline assigned and setting
    bandsperrecord. It worked fine, but I don't know how in RAP to
    calculate the number of lines I need. Can you help there?

    3) I saw this demo but it wasn't using RAP so I haven't pursued it.

    Thanks,



  • edited February 2003
    I'll have to adapt the draw command demo to use RAP. Draw commands are
    problably the way to go on this one, because they can be added after the
    page has been generated by the report engine, but right before the page is
    sent to the devices. The OnEndPage event is the perfect timing to alter the
    appearance of the page after all the draw commands from the engine have been
    added.


    Cheers,

    Jim Bennett
    Digital Metaphors

    ---------------------------------------
    Article: Draw Command Architecture
    ---------------------------------------

    Page Objects
    -------------

    When a report prints it generates Page objects. Each Page object contains an
    array of DrawCommand objects (Page.DrawCommands[]) that describe what needs
    to be rendered for the page.

    Report --> Pages.DrawCommands[] ---> Device (Printer, Screen, ..) --> final
    output


    DrawCommands Objects
    --------------------

    Component --> DrawCommand

    Each TppComponent generates a DrawCommand object each time
    it prints on a page. For example if the component is a TppLabel and prints
    at the top of the page - one draw command object will be created for each
    page. If the Label is in the detail band, many draw commands will be created
    for each page.

    A DrawCommand contains a complete description of the location and content to
    draw. See ppDrwCmd.pas for the existing DrawCommand class descendants
    (DrawText, DrawImage, etc.)

    Some of the basic DrawCommand classes such as DrawImage and DrawText, rely
    on the ScreenDevice and PrinterDevice classes to render their content. Other
    DrawCommand classes such as TppDrawBarCode and TppDrawRichText render
    themselves to the appropriate device canvas directly.


    Creating Custom Components
    --------------------------

    Each component has an associated DrawCommand class that is
    is the value of its DrawCommandClass property. For a Label,
    the DrawCommandClass is TppDrawText. This value is normally
    set in the constructor. Examples of the common components
    are located in ppCtrls.pas.



    constructor TmyComponent.Create(AOwner: TComponent);
    begin

    inherited Create(AOwner);

    DrawCommandClass := TppDrawText;

    end;


    Each time the component prints, a DrawCommand object of
    the designated DrawCommand class will automatically be
    created and the components PropertiesToDrawCommand method
    will be called. You override this method to transfer the
    appropriate property values from the component to
    the drawcommand object.


    {------------------------------------------------------------------------}
    { TmyComponent.PropertiesToDrawCommand }

    procedure TmyComponent.PropertiesToDrawCommand(aDrawCommand:
    TppDrawCommand);
    var
    lWrappedText: TStrings;
    lTextBuf: PChar;
    lPrinter: TObject;
    lDrawText: TppDrawText;
    llCharPos: Longint;
    begin

    inherited PropertiesToDrawCommand(aDrawCommand);

    if not(aDrawCommand is TppDrawText) then Exit;

    lDrawText := TppDrawText(aDrawCommand);

    {set properties here}

    lDrawText.Alignment := Alignment;
    lDrawText.AutoSize := AutoSize;
    lDrawText.Color := Color;
    lDrawText.Left := PrintPosRect.Left;
    lDrawText.Top := PrintPosRect.Top;
    lDrawText.Height := PrintPosRect.Bottom - PrintPosRect.Top;
    lDrawText.Width := PrintPosRect.Right - PrintPosRect.Left;
    lDrawText.Text := Text;
    lDrawText.Transparent := Transparent;
    lDrawText.WordWrap := WordWrap;
    lDrawText.Font := Font;


    end;



    Creating Custom DrawCommands
    ----------------------------

    When you create a descendant component you can either
    use an existing draw command class or create a new one.
    For the TeeChart wrapper components, we chose to use
    the existing DrawImage class to specify the TeeChart
    as a metafile image. So it is not always necessary to
    create a draw command class.

    Examples of DrawCommand classes are located in ppDrwCmd.pas.
    A drawcommand will contain published properties that
    contain a complete description of the location and
    content to be rendered.

    DrawCommand classes must be registered - see the
    initization and finalization sections at the bottom
    of the ppDrwCmd.pas unit for an example.

    DrawCommand classes should publish all properties
    used to describe the object.

    DrawCommand classes must implment the Assign
    method to assign the values of all published
    properties from one draw command to another.


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com


  • edited February 2003
    Thanks Jim.

    1) So will you be posting a RAP demo soon?

    2) It is also appealing to be able in general to be able to calculate
    the amount of space from the end of one band (after it has finished)
    and the start of a pre-determined band (or page location) and to use
    that to set the bandsperrecord of a subreport.
    That way you can fill the space with anything, not just a specific
    draw command.

    To do this I think I need RAP sample code to:
    1) get current print position (of where the band with the
    subreport will start to print).
    2) get the start position of the fixed band (just the position
    I think?)
    3) do units conversion and calculate whole number of
    bandsperrecord.


    Thanks,

  • edited February 2003
    Here is the FillPageWithLines tip implemented to work in RAP, along with
    some other PTF to help create draw commands in RAP:)

    http://www.digital-metaphors.com/tips/RAPDrawCommands.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2003
    Thanks Jim your sample looks great. I will give it a wirl in my app.

    Cheers,

This discussion has been closed.