CrossView

BJLBJL Brussels, Belgium
edited 10:17AM in FastReport 3.0
When using CrossView, is there an equivalent to Line MOD 2 to get odd rows highlighted?

BJL

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 10:17AM
    use the onprintcell event

    if rowindex mod 2 = 0 then memo.color := claqua else memo.color := clwhite;
    ;)
  • BJLBJL Brussels, Belgium
    edited 10:17AM
    Thank you Gord. It works.
    Is it possible to extend the higlight to the RowHeader (the 2 first fields of the dataset, in my case)?

    BJL
  • gordkgordk St.Catherines On. Canada.
    edited 10:17AM
    sorry to take so long
    yes you can.
    procedure Cross1OnPrintRowHeader(Memo: TfrxMemoView; HeaderIndexes, HeaderValues, Value: Variant);
    begin
    if HeaderIndexes[0] mod 2 = 0 then memo.color := claqua else memo.color := clwhite;
    end;
    i suppose if either of us read the user manual chapter on crosstabs we would have seen it sooner.
    ;)
  • gordkgordk St.Catherines On. Canada.
    edited 10:17AM
    in case you didn't find how to do it here is a sample

    procedure Cross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin
    if not Cross1.IsGrandTotalRow(rowindex) then
    if rowindex mod 2 = 0 then memo.color := claqua else memo.color := clwhite;
    end;

    procedure Cross1OnPrintRowHeader(Memo: TfrxMemoView; HeaderIndexes, HeaderValues, Value: Variant);
    begin
    if (VarToStr(Value)<>'Grand Total') then
    begin
    if HeaderIndexes[0] mod 2 = 0 then memo.color := claqua else memo.color := clwhite;
    end
    else
    memo.color := clyellow;
    end;

    ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.