How to format frxCrossObject in fastreport

How to format frxCrossObject in fastreport,
i dont know how to get access cell memo,
from demo PrintTable, i want set number format if field is numeric

procedure TForm1.frxReportTableOriginalBeforePrint(Sender: TfrxReportComponent);
var
Cross: TfrxCrossView;
tmp : TfrxCustomMemoView;
i, j: Integer;
begin
if Sender is TfrxCrossView then
begin
Cross := TfrxCrossView(Sender);

FTabel.First;
i := 0;
while not FTabel.Eof do
begin
for j := 0 to FTabel.Fields.Count - 1 do
begin
Cross.AddValue([i], [FTabel.Fields[j].DisplayLabel], [FTabel.Fields[j].Value]);
if FTabel.Fields[j] is TNumericField then
begin
tmp := Cross.CellMemos[j]; // --------------------------> FAILED
tmp.HAlign := haRight;
TfrxFormat(tmp.DisplayFormat).DecimalSeparator := ',';
TfrxFormat(tmp.DisplayFormat).Kind := fkNumeric;
TfrxFormat(tmp.DisplayFormat).FormatStr := '%2.0n';
end;
end;

FTabel.Next;
Inc(i);
end;
end;
end;

Comments

  1. Seems the parameter is an index to a List of Memos. Would be odd if it correlates with row / column count. Don't know more but you should either find another function or perhaps format the cells in FR script. Sorry for being vague.

    ReplyDelete

Post a Comment