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

Reports and Font Style help

edited May 2004 in General
I have a report that I need to print with Bold type only the records in my
files that are flag as print_Bold.

I have a procedure on the report component before_print

If DM.TblAlbums.FieldByName('PREFERED').AsString = 'YES' then begin
ppDBArtist.Font.Name:='ARIAL BLACK';
ppDBArtist.Font.Style:=[fsBold];
end else
ppDBArtist.Font.Name:='ARIAL';
ppDBArtist.Font.Style:=[];

this work but the problem is that every album I have in the report is
printed fsBold if Prefered = YES.
I would like to print fsBold just the records I have flaged as prefered.the
other records they have to be printed with my default font setting.

How do I do that.?

Tia
Charles Urbina

Comments

  • edited May 2004
    Hi Charles,

    How are you assigning the print_bold flag? The easiest way would be to
    create another field in your dataset that keeps track of which records need
    to be bold or not. Then you could simply check the two values at the same
    time...

    if (DM.TblAlbums['prefered'].AsString = 'yes') and
    (DMTblAlbums['flagged'].AsString = 'yes') then
    //Change font
    else
    //keep font the same
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2004
    Nico,

    need

    I have a DM.TblAlbums['prefered'].AsString = 'yes' then
    I change the font.
    The problem is that the font style is change for all the records in the
    table, I just want the records marked as Prefered = 'YES'.

    So that when I print the report if I have 5 rows I should be able to see
    just the row I want to be fsBold the other rows most be the default font.

    Tia
    Charles

    my
  • edited May 2004
    Charles,

    1. You do not want to use the Component.BeforePrint event to do this.
    Instead use the DetailBand.BeforePrint event.

    2. Instead of retrieving the data directly off your dataset, use the
    TppDBPipeline to access the current record.
    Report.DataPipeline['myrecord'];

    Below is a small example I created for you that should get you on the right
    track.

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

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2004
    Nico,
    Thanks for the demo project.

    Regards
    Charles

This discussion has been closed.