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

Change font to Italic + Underline + Bold + Size 8 in Rap

edited July 2009 in RAP
Hi,

In the detailband of my invoice-report a number of rows are presented.
Some rows however have only an infomative function.
These rows all have in common that quantity on the row is 0 (zero).

In DB:
QTY Description Amount
1 My description 500,-
0 My comment 0,-
1 My description 500,-


1. Is there a way to change the font for only these kind of rows to Italic
+ Underline + Bold + Size 8 in Rap?
QTY Description Amount
1 My description 500,-
My comment <- Italic + Underline + Bold
+ Size 8
1 My description 500,-

2. Is there a way to set the property Left for the description only for these
rows to a different number?
Like:
QTY Description Amount
1 My description 500,-
My comment <- Italic + Underline + Bold
+ Size 8 (+ LEFT=60)
1 My description 500,-

Regards,
Stef

Comments

  • edited July 2009
    Hi Stef,

    The easiest way to do this would be to use the DetailBand.BeforePrint event
    to check your data values, then change the font and alignment properties of
    the components inside the band accordingly. If you need to change a group
    of components, you could possible place them inside a TppRegion component
    and use a report object loop to change them with a single call.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2009
    Hello Nico,

    Can you give me a short sample on how to do this?

    Regards,
    Stef
  • edited July 2009

    Here are some simple samples

    1. To check a data value.....

    if myPipeline['Quantity'] = 0 then
    begin
    // set to use special formatting
    end
    else
    begin
    // set to use standard formatting

    end;

    2. To set the Font.Style

    // RAP does not support the set datatype, so we added special RTTI for
    boolean props

    myDBText.Font.Bold:= True;
    myDBText.Font.Italic:= True;
    myDBText.Font.UnderLine := True;
    myDBText.Font.Size := 8;

    // or create global Font object and then assign the entire font

    // use the RAP Global var and global OnCreate/OnDestroy events.

    myDBText.Font := gSpecialFont;

    3. To set the Left property use the same units as the Report.Units

    myDBText.Left := '1.5'; // assuming Report.Units is set to utInches


    All of the above is also covered in the RAP docs and tutorials.


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2009
    Hello Nard,

    Thank you very much for your samples. It helps me a lot.

    Regards,
    Stef
This discussion has been closed.