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

changing a cross tab celll colour

edited July 2006 in RAP
Howzit,
Using RB 10 with Delphi 7.
I'm trying to change a cell's colour in a cross tab, based on the cell's
value. Trying to do this using RAP.
Regards,
Gilbert

Comments

  • edited July 2006

    Run RBuilder\Demos\Crosstabs\Demo.dpr and cehck out ct126.pas, it contains
    an example of formatting cell color. I was able to use the same code in RAP.
    The example uses the Crosstab.OnFormatCell event and the following code to
    alternate cell color from whilte to silver


    procedure CrossTab1OnFormatCell(aElement: TppElement; aColumn: Integer;
    aRow: Integer);
    begin
    if (aRow > 0) and (aColumn > 0) and ((aColumn mod 2) = 0) then
    aElement.Color := clSilver
    else
    aElement.Color := clWhite;

    end;


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2006
    Cool, thanks, how do i get the value in the cell from the row & column
    indeces?


  • edited July 2006

    - In Delphi code you can reference Crosstab.Matrix.Value[aColumn, aRow].

    - For RAP code you will to write a pass thru function.




    Best regards,

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