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

background colors in ppviewer

edited March 2015 in General
Hi,

i have a problem running a report in the ppviewer component.

If i run it from the designer it show the colors correctly.
If i run it to show it on the screen from inside the tppviewer component
the colors are black and white.

I alternate font and background color in the detail after generate like
this:

if kleurteller = 1 then
begin
Detail.Background1.brush.color:=rgb(255,255,255);
dbtMedewerkerNaam.Font.color:=greenfontcolor;
end
else
begin
Detail.Background1.brush.color:=greenfontcolor;
dbtMedewerkerNaam.Font.color:=rgb(255,255,255);
kleurteller:=0;
end;

Both the font color and the background color are rendert to black and
white..

i use version 14.06 with delphi xe2

Any help is apreciated!!!

Kind regards

Ruud

Comments

  • edited March 2015
    Extra information. An image on the same page does keep its colors.
  • edited March 2015
    Hi Ruud,

    If you would like to alternate the detail band color, I suggest using
    the BackgroundColor1 and BackgroundColor2 properties rather than
    manually changing the BackgroundColor1 property in the AfterGenerate event.

    As for the font color, I suggest using the BeforePrint event of the
    detail band to modify the font color. Something like the following...

    if (ppReport1.DetailBand.Count mod 2 = 1) then
    ppLabel1.Font.Color := clGreen
    else
    ppLabel1.Font.Color := clBlack;

    Best Regards,

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

    thanks for the quick response

    It seems the problem is not in the assigning of the colors to the font
    or background.

    I use the GlobalOnCreate event to initialize the colorvariables.
    If i move that to the AFtergenerate as well everything works fine.

    Is the GlobalOnCreate never triggered if a report is run in tppviewer?

    Regards Ruud





    Nico Cizik (Digital Metaphors) schreef op 12-3-2015 17:57:
  • edited March 2015
    Hi Ruud,

    Thanks for the clarification. For future reference, please let us know
    that you are using RAP or post RAP questions in the RAP newsgroup. I
    originally thought you were writing your code in Delphi :).

    When calling PrintToDevices (as you likely are to show the report in the
    TppViewer), the InitializeParameters routine is not automatically called
    which in turn fires the GlobalOnCreate event in RAP. You will need to
    make the call manually if you require this functionality.

    if ppReport1.InitializeParameters then
    ppReport1.PrintToDevices;

    Best Regards,

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

    thanks for you information.

    Actualy i just call loadreport (ppReportExplorer.LoadReport) and then
    call the refresh function on the viewer component.

    Sorry i did not mention RAP. (I was in kind of a stressfull situation
    installing this to run on a big T.v. in a can-tine. A lot of people
    commenting on the lack of colors.)

    I was lucky to find the work arround and will fixs it in the program
    next week.

    Regards

    Ruud
This discussion has been closed.